Commit 2de84b51 by Zia Fazal Committed by Jonathan Piacenti

added document_filename field to submissions model

Removed course module migration
parent 17dd85f6
...@@ -8,16 +8,6 @@ from django.db import models ...@@ -8,16 +8,6 @@ from django.db import models
class Migration(SchemaMigration): class Migration(SchemaMigration):
def forwards(self, orm): def forwards(self, orm):
# Adding model 'CourseModuleCompletion'
db.create_table('api_manager_coursemodulecompletion', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('created', self.gf('model_utils.fields.AutoCreatedField')(default=datetime.datetime.now)),
('modified', self.gf('model_utils.fields.AutoLastModifiedField')(default=datetime.datetime.now)),
('user', self.gf('django.db.models.fields.related.ForeignKey')(related_name='course_completions', to=orm['auth.User'])),
('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)),
))
db.send_create_signal('api_manager', ['CourseModuleCompletion'])
# Adding M2M table for field groups on 'Organization' # Adding M2M table for field groups on 'Organization'
db.create_table('api_manager_organization_groups', ( db.create_table('api_manager_organization_groups', (
...@@ -29,8 +19,6 @@ class Migration(SchemaMigration): ...@@ -29,8 +19,6 @@ class Migration(SchemaMigration):
def backwards(self, orm): def backwards(self, orm):
# Deleting model 'CourseModuleCompletion'
db.delete_table('api_manager_coursemodulecompletion')
# Removing M2M table for field groups on 'Organization' # Removing M2M table for field groups on 'Organization'
db.delete_table('api_manager_organization_groups') db.delete_table('api_manager_organization_groups')
......
# -*- coding: utf-8 -*-
import 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 'WorkgroupSubmission.document_filename'
db.add_column('projects_workgroupsubmission', 'document_filename',
self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'WorkgroupSubmission.document_filename'
db.delete_column('projects_workgroupsubmission', 'document_filename')
models = {
'api_manager.organization': {
'Meta': {'object_name': 'Organization'},
'contact_email': ('django.db.models.fields.EmailField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'contact_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'contact_phone': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True', 'blank': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'display_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'organizations'", 'symmetrical': 'False', 'to': "orm['auth.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'organizations'", 'symmetrical': 'False', 'to': "orm['auth.User']"}),
'workgroups': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'organizations'", 'symmetrical': 'False', 'to': "orm['projects.Workgroup']"})
},
'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'})
},
'projects.project': {
'Meta': {'unique_together': "(('course_id', 'content_id'),)", 'object_name': 'Project'},
'content_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'organization': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'projects'", 'null': 'True', 'on_delete': 'models.SET_NULL', 'to': "orm['api_manager.Organization']"})
},
'projects.workgroup': {
'Meta': {'object_name': 'Workgroup'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'workgroups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.Group']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'project': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'workgroups'", 'to': "orm['projects.Project']"}),
'users': ('django.db.models.fields.related.ManyToManyField', [], {'blank': 'True', 'related_name': "'workgroups'", 'null': 'True', 'symmetrical': 'False', 'to': "orm['auth.User']"})
},
'projects.workgrouppeerreview': {
'Meta': {'object_name': 'WorkgroupPeerReview'},
'answer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'question': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'reviewer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'workgroup_peer_reviewees'", 'to': "orm['auth.User']"}),
'workgroup': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'peer_reviews'", 'to': "orm['projects.Workgroup']"})
},
'projects.workgroupreview': {
'Meta': {'object_name': 'WorkgroupReview'},
'answer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'question': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'reviewer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'workgroup': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'workgroup_reviews'", 'to': "orm['projects.Workgroup']"})
},
'projects.workgroupsubmission': {
'Meta': {'object_name': 'WorkgroupSubmission'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'document_filename': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'document_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'document_mime_type': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'document_url': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submissions'", 'to': "orm['auth.User']"}),
'workgroup': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'submissions'", 'to': "orm['projects.Workgroup']"})
},
'projects.workgroupsubmissionreview': {
'Meta': {'object_name': 'WorkgroupSubmissionReview'},
'answer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'question': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'reviewer': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'submission': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'reviews'", 'to': "orm['projects.WorkgroupSubmission']"})
}
}
complete_apps = ['projects']
\ No newline at end of file
...@@ -58,6 +58,7 @@ class WorkgroupSubmission(TimeStampedModel): ...@@ -58,6 +58,7 @@ class WorkgroupSubmission(TimeStampedModel):
document_id = models.CharField(max_length=255) document_id = models.CharField(max_length=255)
document_url = models.CharField(max_length=255) document_url = models.CharField(max_length=255)
document_mime_type = models.CharField(max_length=255) document_mime_type = models.CharField(max_length=255)
document_filename = models.CharField(max_length=255, blank=True, null=True)
class WorkgroupSubmissionReview(TimeStampedModel): class WorkgroupSubmissionReview(TimeStampedModel):
......
...@@ -68,7 +68,8 @@ class WorkgroupSubmissionSerializer(serializers.HyperlinkedModelSerializer): ...@@ -68,7 +68,8 @@ class WorkgroupSubmissionSerializer(serializers.HyperlinkedModelSerializer):
""" Meta class for defining additional serializer characteristics """ """ Meta class for defining additional serializer characteristics """
model = WorkgroupSubmission model = WorkgroupSubmission
fields = ( fields = (
'id', 'url', 'created', 'modified', 'document_id', 'document_url', 'document_mime_type', 'id', 'url', 'created', 'modified', 'document_id', 'document_url',
'document_mime_type', 'document_filename',
'user', 'workgroup', 'reviews' 'user', 'workgroup', 'reviews'
) )
......
...@@ -47,6 +47,7 @@ class SubmissionsApiTests(TestCase): ...@@ -47,6 +47,7 @@ class SubmissionsApiTests(TestCase):
self.test_document_id = "Document12345.pdf" self.test_document_id = "Document12345.pdf"
self.test_document_url = "http://test-s3.amazonaws.com/bucketname" self.test_document_url = "http://test-s3.amazonaws.com/bucketname"
self.test_document_mime_type = "application/pdf" self.test_document_mime_type = "application/pdf"
self.test_document_filename = "Test PDF Document"
self.test_user = User.objects.create( self.test_user = User.objects.create(
email="test@edx.org", email="test@edx.org",
...@@ -133,6 +134,7 @@ class SubmissionsApiTests(TestCase): ...@@ -133,6 +134,7 @@ class SubmissionsApiTests(TestCase):
'document_id': self.test_document_id, 'document_id': self.test_document_id,
'document_url': self.test_document_url, 'document_url': self.test_document_url,
'document_mime_type': self.test_document_mime_type, 'document_mime_type': self.test_document_mime_type,
'document_filename': self.test_document_filename,
} }
response = self.do_post(self.test_submissions_uri, submission_data) response = self.do_post(self.test_submissions_uri, submission_data)
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
...@@ -143,6 +145,7 @@ class SubmissionsApiTests(TestCase): ...@@ -143,6 +145,7 @@ class SubmissionsApiTests(TestCase):
'document_id': self.test_document_id, 'document_id': self.test_document_id,
'document_url': self.test_document_url, 'document_url': self.test_document_url,
'document_mime_type': self.test_document_mime_type, 'document_mime_type': self.test_document_mime_type,
'document_filename': self.test_document_filename,
} }
response = self.do_post(self.test_submissions_uri, submission_data) response = self.do_post(self.test_submissions_uri, submission_data)
self.assertEqual(response.status_code, 400) self.assertEqual(response.status_code, 400)
...@@ -154,6 +157,7 @@ class SubmissionsApiTests(TestCase): ...@@ -154,6 +157,7 @@ class SubmissionsApiTests(TestCase):
'document_id': self.test_document_id, 'document_id': self.test_document_id,
'document_url': self.test_document_url, 'document_url': self.test_document_url,
'document_mime_type': self.test_document_mime_type, 'document_mime_type': self.test_document_mime_type,
'document_filename': self.test_document_filename,
} }
response = self.do_post(self.test_submissions_uri, submission_data) response = self.do_post(self.test_submissions_uri, submission_data)
self.assertEqual(response.status_code, 201) self.assertEqual(response.status_code, 201)
...@@ -172,6 +176,7 @@ class SubmissionsApiTests(TestCase): ...@@ -172,6 +176,7 @@ class SubmissionsApiTests(TestCase):
self.assertEqual(response.data['document_id'], self.test_document_id) self.assertEqual(response.data['document_id'], self.test_document_id)
self.assertEqual(response.data['document_url'], self.test_document_url) self.assertEqual(response.data['document_url'], self.test_document_url)
self.assertEqual(response.data['document_mime_type'], self.test_document_mime_type) self.assertEqual(response.data['document_mime_type'], self.test_document_mime_type)
self.assertEqual(response.data['document_filename'], self.test_document_filename)
self.assertIsNotNone(response.data['reviews']) self.assertIsNotNone(response.data['reviews'])
self.assertIsNotNone(response.data['created']) self.assertIsNotNone(response.data['created'])
self.assertIsNotNone(response.data['modified']) self.assertIsNotNone(response.data['modified'])
...@@ -188,6 +193,7 @@ class SubmissionsApiTests(TestCase): ...@@ -188,6 +193,7 @@ class SubmissionsApiTests(TestCase):
'document_id': self.test_document_id, 'document_id': self.test_document_id,
'document_url': self.test_document_url, 'document_url': self.test_document_url,
'document_mime_type': self.test_document_mime_type, 'document_mime_type': self.test_document_mime_type,
'document_filename': self.test_document_filename,
} }
response = self.do_post(self.test_submissions_uri, submission_data) response = self.do_post(self.test_submissions_uri, submission_data)
self.assertEqual(response.status_code, 201) self.assertEqual(response.status_code, 201)
......
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