Commit d15f1087 by Chris Dodge

add some limits to field sizes, also make the table names simply be proctoring_

parent 29eca85f
...@@ -9,13 +9,13 @@ class Migration(SchemaMigration): ...@@ -9,13 +9,13 @@ class Migration(SchemaMigration):
def forwards(self, orm): def forwards(self, orm):
# Adding model 'ProctoredExam' # Adding model 'ProctoredExam'
db.create_table('edx_proctoring_proctoredexam', ( db.create_table('proctoring_proctoredexam', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), ('course_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
('content_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), ('content_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)),
('external_id', self.gf('django.db.models.fields.TextField')(null=True, db_index=True)), ('external_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, db_index=True)),
('exam_name', self.gf('django.db.models.fields.TextField')()), ('exam_name', self.gf('django.db.models.fields.TextField')()),
('time_limit_mins', self.gf('django.db.models.fields.IntegerField')()), ('time_limit_mins', self.gf('django.db.models.fields.IntegerField')()),
('is_proctored', self.gf('django.db.models.fields.BooleanField')(default=False)), ('is_proctored', self.gf('django.db.models.fields.BooleanField')(default=False)),
...@@ -24,10 +24,10 @@ class Migration(SchemaMigration): ...@@ -24,10 +24,10 @@ class Migration(SchemaMigration):
db.send_create_signal('edx_proctoring', ['ProctoredExam']) db.send_create_signal('edx_proctoring', ['ProctoredExam'])
# Adding unique constraint on 'ProctoredExam', fields ['course_id', 'content_id'] # Adding unique constraint on 'ProctoredExam', fields ['course_id', 'content_id']
db.create_unique('edx_proctoring_proctoredexam', ['course_id', 'content_id']) db.create_unique('proctoring_proctoredexam', ['course_id', 'content_id'])
# Adding model 'ProctoredExamStudentAttempt' # Adding model 'ProctoredExamStudentAttempt'
db.create_table('edx_proctoring_proctoredexamstudentattempt', ( db.create_table('proctoring_proctoredexamstudentattempt', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
...@@ -35,13 +35,13 @@ class Migration(SchemaMigration): ...@@ -35,13 +35,13 @@ class Migration(SchemaMigration):
('proctored_exam', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['edx_proctoring.ProctoredExam'])), ('proctored_exam', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['edx_proctoring.ProctoredExam'])),
('started_at', self.gf('django.db.models.fields.DateTimeField')(null=True)), ('started_at', self.gf('django.db.models.fields.DateTimeField')(null=True)),
('completed_at', self.gf('django.db.models.fields.DateTimeField')(null=True)), ('completed_at', self.gf('django.db.models.fields.DateTimeField')(null=True)),
('external_id', self.gf('django.db.models.fields.TextField')(null=True, db_index=True)), ('external_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, db_index=True)),
('status', self.gf('django.db.models.fields.CharField')(max_length=64)), ('status', self.gf('django.db.models.fields.CharField')(max_length=64)),
)) ))
db.send_create_signal('edx_proctoring', ['ProctoredExamStudentAttempt']) db.send_create_signal('edx_proctoring', ['ProctoredExamStudentAttempt'])
# Adding model 'ProctoredExamStudentAllowance' # Adding model 'ProctoredExamStudentAllowance'
db.create_table('edx_proctoring_proctoredexamstudentallowance', ( db.create_table('proctoring_proctoredexamstudentallowance', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
...@@ -53,10 +53,10 @@ class Migration(SchemaMigration): ...@@ -53,10 +53,10 @@ class Migration(SchemaMigration):
db.send_create_signal('edx_proctoring', ['ProctoredExamStudentAllowance']) db.send_create_signal('edx_proctoring', ['ProctoredExamStudentAllowance'])
# Adding unique constraint on 'ProctoredExamStudentAllowance', fields ['user_id', 'proctored_exam', 'key'] # Adding unique constraint on 'ProctoredExamStudentAllowance', fields ['user_id', 'proctored_exam', 'key']
db.create_unique('edx_proctoring_proctoredexamstudentallowance', ['user_id', 'proctored_exam_id', 'key']) db.create_unique('proctoring_proctoredexamstudentallowance', ['user_id', 'proctored_exam_id', 'key'])
# Adding model 'ProctoredExamStudentAllowanceHistory' # Adding model 'ProctoredExamStudentAllowanceHistory'
db.create_table('edx_proctoring_proctoredexamstudentallowancehistory', ( db.create_table('proctoring_proctoredexamstudentallowancehistory', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)), ('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)), ('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
...@@ -71,32 +71,32 @@ class Migration(SchemaMigration): ...@@ -71,32 +71,32 @@ class Migration(SchemaMigration):
def backwards(self, orm): def backwards(self, orm):
# Removing unique constraint on 'ProctoredExamStudentAllowance', fields ['user_id', 'proctored_exam', 'key'] # Removing unique constraint on 'ProctoredExamStudentAllowance', fields ['user_id', 'proctored_exam', 'key']
db.delete_unique('edx_proctoring_proctoredexamstudentallowance', ['user_id', 'proctored_exam_id', 'key']) db.delete_unique('proctoring_proctoredexamstudentallowance', ['user_id', 'proctored_exam_id', 'key'])
# Removing unique constraint on 'ProctoredExam', fields ['course_id', 'content_id'] # Removing unique constraint on 'ProctoredExam', fields ['course_id', 'content_id']
db.delete_unique('edx_proctoring_proctoredexam', ['course_id', 'content_id']) db.delete_unique('proctoring_proctoredexam', ['course_id', 'content_id'])
# Deleting model 'ProctoredExam' # Deleting model 'ProctoredExam'
db.delete_table('edx_proctoring_proctoredexam') db.delete_table('proctoring_proctoredexam')
# Deleting model 'ProctoredExamStudentAttempt' # Deleting model 'ProctoredExamStudentAttempt'
db.delete_table('edx_proctoring_proctoredexamstudentattempt') db.delete_table('proctoring_proctoredexamstudentattempt')
# Deleting model 'ProctoredExamStudentAllowance' # Deleting model 'ProctoredExamStudentAllowance'
db.delete_table('edx_proctoring_proctoredexamstudentallowance') db.delete_table('proctoring_proctoredexamstudentallowance')
# Deleting model 'ProctoredExamStudentAllowanceHistory' # Deleting model 'ProctoredExamStudentAllowanceHistory'
db.delete_table('edx_proctoring_proctoredexamstudentallowancehistory') db.delete_table('proctoring_proctoredexamstudentallowancehistory')
models = { models = {
'edx_proctoring.proctoredexam': { 'edx_proctoring.proctoredexam': {
'Meta': {'unique_together': "(('course_id', 'content_id'),)", 'object_name': 'ProctoredExam'}, 'Meta': {'unique_together': "(('course_id', 'content_id'),)", 'object_name': 'ProctoredExam', 'db_table': "'proctoring_proctoredexam'"},
'content_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'content_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}), 'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'exam_name': ('django.db.models.fields.TextField', [], {}), 'exam_name': ('django.db.models.fields.TextField', [], {}),
'external_id': ('django.db.models.fields.TextField', [], {'null': 'True', 'db_index': 'True'}), 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_proctored': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), 'is_proctored': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
...@@ -104,7 +104,7 @@ class Migration(SchemaMigration): ...@@ -104,7 +104,7 @@ class Migration(SchemaMigration):
'time_limit_mins': ('django.db.models.fields.IntegerField', [], {}) 'time_limit_mins': ('django.db.models.fields.IntegerField', [], {})
}, },
'edx_proctoring.proctoredexamstudentallowance': { 'edx_proctoring.proctoredexamstudentallowance': {
'Meta': {'unique_together': "(('user_id', 'proctored_exam', 'key'),)", 'object_name': 'ProctoredExamStudentAllowance'}, 'Meta': {'unique_together': "(('user_id', 'proctored_exam', 'key'),)", 'object_name': 'ProctoredExamStudentAllowance', 'db_table': "'proctoring_proctoredexamstudentallowance'"},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '255'}), 'key': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
...@@ -114,7 +114,7 @@ class Migration(SchemaMigration): ...@@ -114,7 +114,7 @@ class Migration(SchemaMigration):
'value': ('django.db.models.fields.CharField', [], {'max_length': '255'}) 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
}, },
'edx_proctoring.proctoredexamstudentallowancehistory': { 'edx_proctoring.proctoredexamstudentallowancehistory': {
'Meta': {'object_name': 'ProctoredExamStudentAllowanceHistory'}, 'Meta': {'object_name': 'ProctoredExamStudentAllowanceHistory', 'db_table': "'proctoring_proctoredexamstudentallowancehistory'"},
'allowance_id': ('django.db.models.fields.IntegerField', [], {}), 'allowance_id': ('django.db.models.fields.IntegerField', [], {}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
...@@ -125,10 +125,10 @@ class Migration(SchemaMigration): ...@@ -125,10 +125,10 @@ class Migration(SchemaMigration):
'value': ('django.db.models.fields.CharField', [], {'max_length': '255'}) 'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
}, },
'edx_proctoring.proctoredexamstudentattempt': { 'edx_proctoring.proctoredexamstudentattempt': {
'Meta': {'object_name': 'ProctoredExamStudentAttempt'}, 'Meta': {'object_name': 'ProctoredExamStudentAttempt', 'db_table': "'proctoring_proctoredexamstudentattempt'"},
'completed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}), 'completed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}), 'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'external_id': ('django.db.models.fields.TextField', [], {'null': 'True', 'db_index': 'True'}), 'external_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}), 'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'proctored_exam': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edx_proctoring.ProctoredExam']"}), 'proctored_exam': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edx_proctoring.ProctoredExam']"}),
......
...@@ -21,7 +21,7 @@ class ProctoredExam(TimeStampedModel): ...@@ -21,7 +21,7 @@ class ProctoredExam(TimeStampedModel):
content_id = models.CharField(max_length=255, db_index=True) content_id = models.CharField(max_length=255, db_index=True)
# This will be a integration specific ID - say to SoftwareSecure. # This will be a integration specific ID - say to SoftwareSecure.
external_id = models.TextField(null=True, db_index=True) external_id = models.CharField(max_length=255, null=True, db_index=True)
# This is the display name of the Exam (Midterm etc). # This is the display name of the Exam (Midterm etc).
exam_name = models.TextField() exam_name = models.TextField()
...@@ -38,6 +38,7 @@ class ProctoredExam(TimeStampedModel): ...@@ -38,6 +38,7 @@ class ProctoredExam(TimeStampedModel):
class Meta: class Meta:
""" Meta class for this Django model """ """ Meta class for this Django model """
unique_together = (('course_id', 'content_id'),) unique_together = (('course_id', 'content_id'),)
db_table = 'proctoring_proctoredexam'
@classmethod @classmethod
def get_exam_by_content_id(cls, course_id, content_id): def get_exam_by_content_id(cls, course_id, content_id):
...@@ -78,11 +79,15 @@ class ProctoredExamStudentAttempt(TimeStampedModel): ...@@ -78,11 +79,15 @@ class ProctoredExamStudentAttempt(TimeStampedModel):
completed_at = models.DateTimeField(null=True) completed_at = models.DateTimeField(null=True)
# This will be a integration specific ID - say to SoftwareSecure. # This will be a integration specific ID - say to SoftwareSecure.
external_id = models.TextField(null=True, db_index=True) external_id = models.CharField(max_length=255, null=True, db_index=True)
# what is the status of this attempt # what is the status of this attempt
status = models.CharField(max_length=64) status = models.CharField(max_length=64)
class Meta:
""" Meta class for this Django model """
db_table = 'proctoring_proctoredexamstudentattempt'
@property @property
def is_active(self): def is_active(self):
""" returns boolean if this attempt is considered active """ """ returns boolean if this attempt is considered active """
...@@ -154,6 +159,7 @@ class ProctoredExamStudentAllowance(TimeStampedModel): ...@@ -154,6 +159,7 @@ class ProctoredExamStudentAllowance(TimeStampedModel):
class Meta: class Meta:
""" Meta class for this Django model """ """ Meta class for this Django model """
unique_together = (('user_id', 'proctored_exam', 'key'),) unique_together = (('user_id', 'proctored_exam', 'key'),)
db_table = 'proctoring_proctoredexamstudentallowance'
@classmethod @classmethod
def get_allowance_for_user(cls, exam_id, user_id, key): def get_allowance_for_user(cls, exam_id, user_id, key):
...@@ -196,6 +202,10 @@ class ProctoredExamStudentAllowanceHistory(TimeStampedModel): ...@@ -196,6 +202,10 @@ class ProctoredExamStudentAllowanceHistory(TimeStampedModel):
value = models.CharField(max_length=255) value = models.CharField(max_length=255)
class Meta:
""" Meta class for this Django model """
db_table = 'proctoring_proctoredexamstudentallowancehistory'
# Hook up the post_save signal to record creations in the ProctoredExamStudentAllowanceHistory table. # Hook up the post_save signal to record creations in the ProctoredExamStudentAllowanceHistory table.
@receiver(post_save, sender=ProctoredExamStudentAllowance) @receiver(post_save, sender=ProctoredExamStudentAllowance)
......
# Django/Framework Packages # Django/Framework Packages
django>=1.4.12,<=1.4.18 django>=1.4.12,<=1.4.20
django-model-utils==1.4.0 django-model-utils==1.4.0
South>=0.7.6 South>=0.7.6
djangorestframework>=2.3.5,<=2.3.14 djangorestframework>=2.3.5,<=2.3.14
......
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