Commit 6f649553 by chrisndodge

Merge pull request #180 from edx/django1.8-upgrade

Upgrade django to 1.8.
parents 204f3e79 f1101736
......@@ -52,6 +52,7 @@ class ProctoredExamSoftwareSecureReviewForm(forms.ModelForm):
"""Admin Form to display for reading/updating a Review"""
class Meta(object): # pylint: disable=missing-docstring
model = ProctoredExamSoftwareSecureReview
fields = '__all__'
REVIEW_STATUS_CHOICES = [
('Clean', 'Clean'),
......
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ProctoredExamStudentAttempt.attempt_code'
db.add_column('proctoring_proctoredexamstudentattempt', 'attempt_code',
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, db_index=True),
keep_default=False)
# Adding field 'ProctoredExamStudentAttempt.is_sample_attempt'
db.add_column('proctoring_proctoredexamstudentattempt', 'is_sample_attempt',
self.gf('django.db.models.fields.BooleanField')(default=False),
keep_default=False)
def backwards(self, orm):
# Deleting field 'ProctoredExamStudentAttempt.attempt_code'
db.delete_column('proctoring_proctoredexamstudentattempt', 'attempt_code')
# Deleting field 'ProctoredExamStudentAttempt.is_sample_attempt'
db.delete_column('proctoring_proctoredexamstudentattempt', 'is_sample_attempt')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'edx_proctoring.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'}),
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'exam_name': ('django.db.models.fields.TextField', [], {}),
'external_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_proctored': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'time_limit_mins': ('django.db.models.fields.IntegerField', [], {})
},
'edx_proctoring.proctoredexamstudentallowance': {
'Meta': {'unique_together': "(('user', 'proctored_exam', 'key'),)", 'object_name': 'ProctoredExamStudentAllowance', 'db_table': "'proctoring_proctoredexamstudentallowance'"},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'proctored_exam': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edx_proctoring.ProctoredExam']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
'edx_proctoring.proctoredexamstudentallowancehistory': {
'Meta': {'object_name': 'ProctoredExamStudentAllowanceHistory', 'db_table': "'proctoring_proctoredexamstudentallowancehistory'"},
'allowance_id': ('django.db.models.fields.IntegerField', [], {}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'key': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'proctored_exam': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edx_proctoring.ProctoredExam']"}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"}),
'value': ('django.db.models.fields.CharField', [], {'max_length': '255'})
},
'edx_proctoring.proctoredexamstudentattempt': {
'Meta': {'object_name': 'ProctoredExamStudentAttempt', 'db_table': "'proctoring_proctoredexamstudentattempt'"},
'allowed_time_limit_mins': ('django.db.models.fields.IntegerField', [], {}),
'attempt_code': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
'completed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'external_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_sample_attempt': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'proctored_exam': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['edx_proctoring.ProctoredExam']"}),
'started_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),
'status': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'student_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'taking_as_proctored': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
}
}
complete_apps = ['edx_proctoring']
\ No newline at end of file
......@@ -42,13 +42,13 @@ class ProctoredExam(TimeStampedModel):
due_date = models.DateTimeField(null=True)
# Whether this exam actually is proctored or not.
is_proctored = models.BooleanField()
is_proctored = models.BooleanField(default=False)
# Whether this exam is for practice only.
is_practice_exam = models.BooleanField()
is_practice_exam = models.BooleanField(default=False)
# Whether this exam will be active.
is_active = models.BooleanField()
is_active = models.BooleanField(default=False)
class Meta:
""" Meta class for this Django model """
......@@ -349,7 +349,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
else Returns None.
"""
try:
exam_attempt_obj = self.get(proctored_exam_id=exam_id, user_id=user_id)
exam_attempt_obj = self.get(proctored_exam_id=exam_id, user_id=user_id) # pylint: disable=no-member
except ObjectDoesNotExist: # pylint: disable=no-member
exam_attempt_obj = None
return exam_attempt_obj
......@@ -359,7 +359,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
Returns the Student Exam Attempt by the attempt_id else return None
"""
try:
exam_attempt_obj = self.get(id=attempt_id)
exam_attempt_obj = self.get(id=attempt_id) # pylint: disable=no-member
except ObjectDoesNotExist: # pylint: disable=no-member
exam_attempt_obj = None
return exam_attempt_obj
......@@ -370,7 +370,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
else Returns None.
"""
try:
exam_attempt_obj = self.get(attempt_code=attempt_code)
exam_attempt_obj = self.get(attempt_code=attempt_code) # pylint: disable=no-member
except ObjectDoesNotExist: # pylint: disable=no-member
exam_attempt_obj = None
return exam_attempt_obj
......@@ -396,7 +396,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
if timed_exams_only:
filtered_query = filtered_query & Q(proctored_exam__is_proctored=False)
return self.filter(filtered_query).order_by('-created')
return self.filter(filtered_query).order_by('-created') # pylint: disable=no-member
def get_active_student_attempts(self, user_id, course_id=None):
"""
......@@ -407,7 +407,7 @@ class ProctoredExamStudentAttemptManager(models.Manager):
if course_id is not None:
filtered_query = filtered_query & Q(proctored_exam__course_id=course_id)
return self.filter(filtered_query).order_by('-created')
return self.filter(filtered_query).order_by('-created') # pylint: disable=no-member
class ProctoredExamStudentAttempt(TimeStampedModel):
......@@ -445,11 +445,11 @@ class ProctoredExamStudentAttempt(TimeStampedModel):
# if the user is attempting this as a proctored exam
# in case there is an option to opt-out
taking_as_proctored = models.BooleanField()
taking_as_proctored = models.BooleanField(default=False)
# Whether this attempt is considered a sample attempt, e.g. to try out
# the proctoring software
is_sample_attempt = models.BooleanField()
is_sample_attempt = models.BooleanField(default=False)
student_name = models.CharField(max_length=255)
......@@ -484,7 +484,7 @@ class ProctoredExamStudentAttempt(TimeStampedModel):
external_id=external_id,
status=ProctoredExamStudentAttemptStatus.created,
review_policy_id=review_policy_id
)
) # pylint: disable=no-member
def delete_exam_attempt(self):
"""
......@@ -525,11 +525,11 @@ class ProctoredExamStudentAttemptHistory(TimeStampedModel):
# if the user is attempting this as a proctored exam
# in case there is an option to opt-out
taking_as_proctored = models.BooleanField()
taking_as_proctored = models.BooleanField(default=False)
# Whether this attampt is considered a sample attempt, e.g. to try out
# the proctoring software
is_sample_attempt = models.BooleanField()
is_sample_attempt = models.BooleanField(default=False)
student_name = models.CharField(max_length=255)
......@@ -629,7 +629,7 @@ def on_attempt_updated(sender, instance, **kwargs): # pylint: disable=unused-ar
archive_object.save()
class QuerySetWithUpdateOverride(models.query.QuerySet):
class QuerySetWithUpdateOverride(models.QuerySet):
"""
Custom QuerySet class to make an archive copy
every time the object is updated.
......@@ -644,7 +644,10 @@ class ProctoredExamStudentAllowanceManager(models.Manager):
Custom manager to override with the custom queryset
to enable archiving on Allowance updation.
"""
def get_query_set(self):
def get_queryset(self):
"""
Return a specialized queryset
"""
return QuerySetWithUpdateOverride(self.model, using=self._db)
......
......@@ -177,7 +177,8 @@ class ProctoredExamViewTests(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.exam'),
updated_exam_data
json.dumps(updated_exam_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -246,7 +247,8 @@ class ProctoredExamViewTests(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.exam'),
updated_exam_data
json.dumps(updated_exam_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 400)
......@@ -499,9 +501,10 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': 'start',
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1021,9 +1024,10 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': 'stop',
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1049,7 +1053,8 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
}
response = self.client.post(
reverse('edx_proctoring.proctored_exam.attempt.collection'),
attempt_data
json.dumps(attempt_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1059,9 +1064,10 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': 'click_download_software',
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1105,9 +1111,10 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': action,
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1121,18 +1128,20 @@ class TestStudentProctoredExamAttempt(LoggedInTestCase):
# we should not be able to restart it
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': 'start',
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 400)
response = self.client.put(
reverse('edx_proctoring.proctored_exam.attempt', args=[old_attempt_id]),
{
json.dumps({
'action': 'stop',
}
}),
content_type='application/json'
)
self.assertEqual(response.status_code, 400)
......@@ -1904,7 +1913,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -1929,7 +1939,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 400)
response_data = json.loads(response.content)
......@@ -1957,7 +1968,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 400)
response_data = json.loads(response.content)
......@@ -1989,7 +2001,8 @@ class TestExamAllowanceView(LoggedInTestCase):
# Try to add an allowance
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
# Returns a 400 status.
self.assertEqual(response.status_code, 400)
......@@ -2015,7 +2028,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2023,7 +2037,8 @@ class TestExamAllowanceView(LoggedInTestCase):
response = self.client.delete(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2052,7 +2067,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 403)
response_data = json.loads(response.content)
......@@ -2079,7 +2095,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2118,7 +2135,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2158,7 +2176,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2180,7 +2199,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2218,7 +2238,8 @@ class TestExamAllowanceView(LoggedInTestCase):
}
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2259,7 +2280,8 @@ class TestExamAllowanceView(LoggedInTestCase):
# Add allowance
response = self.client.put(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......@@ -2271,7 +2293,8 @@ class TestExamAllowanceView(LoggedInTestCase):
response = self.client.delete(
reverse('edx_proctoring.proctored_exam.allowance'),
allowance_data
json.dumps(allowance_data),
content_type='application/json'
)
self.assertEqual(response.status_code, 200)
......
# Django/Framework Packages
django>=1.4.12,<=1.4.22
django>=1.8,<1.9
django-model-utils==2.3.1
South>=0.7.6
djangorestframework>=3.1,<3.2
django-ipware==1.1.0
pytz>=2012h
......
......@@ -39,7 +39,7 @@ load-plugins=
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
# I0011 locally-disabled (module-level pylint overrides)
disable=I0011,W0232,too-few-public-methods,abstract-class-little-used,abstract-class-not-used,too-many-public-methods,no-self-use,too-many-instance-attributes,duplicate-code,too-many-arguments,too-many-locals,old-style-class
disable=I0011,W0232,too-few-public-methods,abstract-class-little-used,abstract-class-not-used,too-many-public-methods,no-self-use,too-many-instance-attributes,duplicate-code,too-many-arguments,too-many-locals,old-style-class,no-member
[REPORTS]
......
......@@ -40,7 +40,6 @@ INSTALLED_APPS = (
'rest_framework',
'edx_proctoring',
'django_nose',
'south',
)
# Static files (CSS, JavaScript, Images)
......
......@@ -34,7 +34,7 @@ def load_requirements(*requirements_paths):
setup(
name='edx-proctoring',
version='0.11.0',
version='0.11.2',
description='Proctoring subsystem for Open edX',
long_description=open('README.md').read(),
author='edX',
......
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