Commit 4926701e by David Ormsbee

add migrations for initial courseware and adding indexes

parent 2cd105ce
...@@ -9,9 +9,9 @@ class StudentModule(models.Model): ...@@ -9,9 +9,9 @@ class StudentModule(models.Model):
('html','html'), ('html','html'),
) )
## These three are the key for the object ## These three are the key for the object
module_type = models.CharField(max_length=32, choices=MODULE_TYPES, default='problem') module_type = models.CharField(max_length=32, choices=MODULE_TYPES, default='problem', db_index=True)
module_id = models.CharField(max_length=255) # Filename for homeworks, etc. module_id = models.CharField(max_length=255, db_index=True) # Filename for homeworks, etc.
student = models.ForeignKey(User) student = models.ForeignKey(User, db_index=True)
class Meta: class Meta:
unique_together = (('student', 'module_id', 'module_type'),) unique_together = (('student', 'module_id', 'module_type'),)
...@@ -19,7 +19,7 @@ class StudentModule(models.Model): ...@@ -19,7 +19,7 @@ class StudentModule(models.Model):
state = models.TextField(null=True, blank=True) state = models.TextField(null=True, blank=True)
## Grade, and are we done? ## Grade, and are we done?
grade = models.FloatField(null=True, blank=True) grade = models.FloatField(null=True, blank=True, db_index=True)
#max_grade = models.FloatField(null=True, blank=True) #max_grade = models.FloatField(null=True, blank=True)
# DONE_TYPES = (('done','DONE'), # Finished # DONE_TYPES = (('done','DONE'), # Finished
...@@ -27,8 +27,8 @@ class StudentModule(models.Model): ...@@ -27,8 +27,8 @@ class StudentModule(models.Model):
# ('na','NA')) # Not applicable (e.g. vertical) # ('na','NA')) # Not applicable (e.g. vertical)
# done = models.CharField(max_length=16, choices=DONE_TYPES) # done = models.CharField(max_length=16, choices=DONE_TYPES)
created = models.DateTimeField(auto_now_add=True) created = models.DateTimeField(auto_now_add=True, db_index=True)
modified = models.DateTimeField(auto_now=True) modified = models.DateTimeField(auto_now=True, db_index=True)
def __unicode__(self): def __unicode__(self):
return self.module_type+'/'+self.student.username+"/"+self.module_id+'/'+str(self.state)[:20] return self.module_type+'/'+self.student.username+"/"+self.module_id+'/'+str(self.state)[:20]
...@@ -42,9 +42,9 @@ class UserProfile(models.Model): ...@@ -42,9 +42,9 @@ class UserProfile(models.Model):
# Sanitize all fields. # Sanitize all fields.
# This is not visible to other users, but could introduce holes later # This is not visible to other users, but could introduce holes later
user = models.ForeignKey(User, unique=True, db_index=True) user = models.ForeignKey(User, unique=True, db_index=True)
name = models.TextField(blank=True) name = models.TextField(blank=True, db_index=True)
language = models.TextField(blank=True) language = models.TextField(blank=True, db_index=True)
location = models.TextField(blank=True) location = models.TextField(blank=True, db_index=True)
meta = models.TextField(blank=True) # JSON dictionary for future expansion meta = models.TextField(blank=True) # JSON dictionary for future expansion
courseware = models.TextField(blank=True, default='course.xml') courseware = models.TextField(blank=True, default='course.xml')
...@@ -54,7 +54,6 @@ class Registration(models.Model): ...@@ -54,7 +54,6 @@ class Registration(models.Model):
registration profile is created when the user creates an registration profile is created when the user creates an
account, but that account is inactive. Once the user clicks account, but that account is inactive. Once the user clicks
on the activation key, it becomes active. ''' on the activation key, it becomes active. '''
class Meta: class Meta:
db_table = "auth_userprofile" db_table = "auth_userprofile"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment