Commit 0f139f51 by Brian Beggs

Merge pull request #55 from edx/ammar/upgrade-django-1.8

upgrade to django 1.8
parents 5db12411 ef0c5c8b
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import datetime from __future__ import unicode_literals
from south.db import db
from south.v2 import SchemaMigration from django.db import models, migrations
from django.db import models import django.core.validators
import edxval.models
class Migration(SchemaMigration):
class Migration(migrations.Migration):
def forwards(self, orm):
# Adding model 'Profile' dependencies = [
db.create_table('edxval_profile', ( ]
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
('profile_name', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50)), operations = [
('extension', self.gf('django.db.models.fields.CharField')(max_length=10)), migrations.CreateModel(
('width', self.gf('django.db.models.fields.PositiveIntegerField')()), name='CourseVideo',
('height', self.gf('django.db.models.fields.PositiveIntegerField')()), fields=[
)) ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
db.send_create_signal('edxval', ['Profile']) ('course_id', models.CharField(max_length=255)),
],
# Adding model 'Video' bases=(models.Model, edxval.models.ModelFactoryWithValidation),
db.create_table('edxval_video', ( ),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), migrations.CreateModel(
('edx_video_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=50)), name='EncodedVideo',
('client_video_id', self.gf('django.db.models.fields.CharField')(max_length=255, db_index=True)), fields=[
('duration', self.gf('django.db.models.fields.FloatField')()), ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
)) ('created', models.DateTimeField(auto_now_add=True)),
db.send_create_signal('edxval', ['Video']) ('modified', models.DateTimeField(auto_now=True)),
('url', models.CharField(max_length=200)),
# Adding model 'CourseVideo' ('file_size', models.PositiveIntegerField()),
db.create_table('edxval_coursevideo', ( ('bitrate', models.PositiveIntegerField()),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ],
('course_id', self.gf('django.db.models.fields.CharField')(max_length=255)), ),
('video', self.gf('django.db.models.fields.related.ForeignKey')(related_name='courses', to=orm['edxval.Video'])), migrations.CreateModel(
)) name='Profile',
db.send_create_signal('edxval', ['CourseVideo']) fields=[
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
# Adding unique constraint on 'CourseVideo', fields ['course_id', 'video'] ('profile_name', models.CharField(unique=True, max_length=50, validators=[django.core.validators.RegexValidator(regex=b'^[a-zA-Z0-9\\-_]*$', message=b'profile_name has invalid characters', code=b'invalid profile_name')])),
db.create_unique('edxval_coursevideo', ['course_id', 'video_id']) ],
),
# Adding model 'EncodedVideo' migrations.CreateModel(
db.create_table('edxval_encodedvideo', ( name='Subtitle',
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), fields=[
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), ('created', models.DateTimeField(auto_now_add=True)),
('url', self.gf('django.db.models.fields.URLField')(max_length=200)), ('modified', models.DateTimeField(auto_now=True)),
('file_size', self.gf('django.db.models.fields.PositiveIntegerField')()), ('fmt', models.CharField(db_index=True, max_length=20, choices=[(b'srt', b'SubRip'), (b'sjson', b'SRT JSON')])),
('bitrate', self.gf('django.db.models.fields.PositiveIntegerField')()), ('language', models.CharField(max_length=8, db_index=True)),
('profile', self.gf('django.db.models.fields.related.ForeignKey')(related_name='+', to=orm['edxval.Profile'])), ('content', models.TextField(default=b'')),
('video', self.gf('django.db.models.fields.related.ForeignKey')(related_name='encoded_videos', to=orm['edxval.Video'])), ],
)) ),
db.send_create_signal('edxval', ['EncodedVideo']) migrations.CreateModel(
name='Video',
# Adding model 'Subtitle' fields=[
db.create_table('edxval_subtitle', ( ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('created', models.DateTimeField(auto_now_add=True)),
('created', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, blank=True)), ('edx_video_id', models.CharField(unique=True, max_length=100, validators=[django.core.validators.RegexValidator(regex=b'^[a-zA-Z0-9\\-_]*$', message=b'edx_video_id has invalid characters', code=b'invalid edx_video_id')])),
('modified', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)), ('client_video_id', models.CharField(db_index=True, max_length=255, blank=True)),
('video', self.gf('django.db.models.fields.related.ForeignKey')(related_name='subtitles', to=orm['edxval.Video'])), ('duration', models.FloatField(validators=[django.core.validators.MinValueValidator(0)])),
('fmt', self.gf('django.db.models.fields.CharField')(max_length=20, db_index=True)), ('status', models.CharField(max_length=255, db_index=True)),
('language', self.gf('django.db.models.fields.CharField')(max_length=8, db_index=True)), ],
('content', self.gf('django.db.models.fields.TextField')(default='')), ),
)) migrations.AddField(
db.send_create_signal('edxval', ['Subtitle']) model_name='subtitle',
name='video',
field=models.ForeignKey(related_name='subtitles', to='edxval.Video'),
def backwards(self, orm): ),
# Removing unique constraint on 'CourseVideo', fields ['course_id', 'video'] migrations.AddField(
db.delete_unique('edxval_coursevideo', ['course_id', 'video_id']) model_name='encodedvideo',
name='profile',
# Deleting model 'Profile' field=models.ForeignKey(related_name='+', to='edxval.Profile'),
db.delete_table('edxval_profile') ),
migrations.AddField(
# Deleting model 'Video' model_name='encodedvideo',
db.delete_table('edxval_video') name='video',
field=models.ForeignKey(related_name='encoded_videos', to='edxval.Video'),
# Deleting model 'CourseVideo' ),
db.delete_table('edxval_coursevideo') migrations.AddField(
model_name='coursevideo',
# Deleting model 'EncodedVideo' name='video',
db.delete_table('edxval_encodedvideo') field=models.ForeignKey(related_name='courses', to='edxval.Video'),
),
# Deleting model 'Subtitle' migrations.AlterUniqueTogether(
db.delete_table('edxval_subtitle') name='coursevideo',
unique_together=set([('course_id', 'video')]),
),
models = { ]
'edxval.coursevideo': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideo'},
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['edxval.Video']"})
},
'edxval.encodedvideo': {
'Meta': {'object_name': 'EncodedVideo'},
'bitrate': ('django.db.models.fields.PositiveIntegerField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['edxval.Profile']"}),
'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'encoded_videos'", 'to': "orm['edxval.Video']"})
},
'edxval.profile': {
'Meta': {'object_name': 'Profile'},
'extension': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'height': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'profile_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
'width': ('django.db.models.fields.PositiveIntegerField', [], {})
},
'edxval.subtitle': {
'Meta': {'object_name': 'Subtitle'},
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'fmt': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['edxval.Video']"})
},
'edxval.video': {
'Meta': {'object_name': 'Video'},
'client_video_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {}),
'edx_video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['edxval']
\ No newline at end of file
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
DEFAULT_PROFILES = [
"desktop_mp4",
"desktop_webm",
"mobile_high",
"mobile_low",
"youtube",
]
def create_default_profiles(apps, schema_editor):
""" Add default profiles """
Profile = apps.get_model("edxval", "Profile")
db_alias = schema_editor.connection.alias
for profile in DEFAULT_PROFILES:
Profile.objects.using(db_alias).get_or_create(profile_name=profile)
def delete_default_profiles(apps, schema_editor):
""" Remove default profiles """
Profile = apps.get_model("edxval", "Profile")
db_alias = schema_editor.connection.alias
Profile.objects.using(db_alias).filter(profile_name__in=DEFAULT_PROFILES).delete()
class Migration(migrations.Migration):
dependencies = [
('edxval', '0001_initial'),
]
operations = [
migrations.RunPython(create_default_profiles, delete_default_profiles),
]
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
orm.Profile.objects.bulk_create([
orm.Profile(profile_name="desktop_mp4", width=1280, height= 720, extension="mp4"),
orm.Profile(profile_name="desktop_webm", width=1280, height= 720, extension="webm"),
orm.Profile(profile_name="mobile_high", width= 960, height= 540, extension="mp4"),
orm.Profile(profile_name="mobile_low", width= 640, height= 360, extension="mp4"),
orm.Profile(profile_name="youtube", width=1920, height=1080, extension="mp4"),
])
# Note: Remember to use orm['appname.ModelName'] rather than "from appname.models..."
def backwards(self, orm):
"Write your backwards methods here."
orm.Profile.objects.filter(
profile_name__in=["desktop_mp4", "desktop_webm", "mobile_high", "mobile_low", "youtube"]
).delete()
models = {
'edxval.coursevideo': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideo'},
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['edxval.Video']"})
},
'edxval.encodedvideo': {
'Meta': {'object_name': 'EncodedVideo'},
'bitrate': ('django.db.models.fields.PositiveIntegerField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['edxval.Profile']"}),
'url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'encoded_videos'", 'to': "orm['edxval.Video']"})
},
'edxval.profile': {
'Meta': {'object_name': 'Profile'},
'extension': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'height': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'profile_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
'width': ('django.db.models.fields.PositiveIntegerField', [], {})
},
'edxval.subtitle': {
'Meta': {'object_name': 'Subtitle'},
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'fmt': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['edxval.Video']"})
},
'edxval.video': {
'Meta': {'object_name': 'Video'},
'client_video_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {}),
'edx_video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
}
}
complete_apps = ['edxval']
symmetrical = True
# -*- 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 'Video.created'
db.add_column('edxval_video', 'created',
self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, default=datetime.datetime(2014, 11, 17, 0, 0), blank=True),
keep_default=False)
# Adding field 'Video.status'
db.add_column('edxval_video', 'status',
self.gf('django.db.models.fields.CharField')(default='File Complete', max_length=255, db_index=True),
keep_default=False)
# Changing field 'Video.edx_video_id'
db.alter_column('edxval_video', 'edx_video_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=100))
# Changing field 'EncodedVideo.url'
db.alter_column('edxval_encodedvideo', 'url', self.gf('django.db.models.fields.CharField')(max_length=200))
def backwards(self, orm):
# Deleting field 'Video.created'
db.delete_column('edxval_video', 'created')
# Deleting field 'Video.status'
db.delete_column('edxval_video', 'status')
# Changing field 'Video.edx_video_id'
db.alter_column('edxval_video', 'edx_video_id', self.gf('django.db.models.fields.CharField')(max_length=50, unique=True))
# Changing field 'EncodedVideo.url'
db.alter_column('edxval_encodedvideo', 'url', self.gf('django.db.models.fields.URLField')(max_length=200))
models = {
'edxval.coursevideo': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideo'},
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['edxval.Video']"})
},
'edxval.encodedvideo': {
'Meta': {'object_name': 'EncodedVideo'},
'bitrate': ('django.db.models.fields.PositiveIntegerField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['edxval.Profile']"}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'encoded_videos'", 'to': "orm['edxval.Video']"})
},
'edxval.profile': {
'Meta': {'object_name': 'Profile'},
'extension': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
'height': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'profile_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'}),
'width': ('django.db.models.fields.PositiveIntegerField', [], {})
},
'edxval.subtitle': {
'Meta': {'object_name': 'Subtitle'},
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'fmt': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['edxval.Video']"})
},
'edxval.video': {
'Meta': {'object_name': 'Video'},
'client_video_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {}),
'edx_video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'status': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
}
}
complete_apps = ['edxval']
\ No newline at end of file
# -*- 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):
# The extension, width, and height fields of the Profile model are
# removed, but we want this migration to be non-destructive. Thus, the
# columns are simply altered to allow null values.
db.alter_column('edxval_profile', 'width', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, default=1))
db.alter_column('edxval_profile', 'extension', self.gf('django.db.models.fields.CharField')(max_length=10, null=True, default='mp4'))
db.alter_column('edxval_profile', 'height', self.gf('django.db.models.fields.PositiveIntegerField')(null=True, default=1))
# On MySQL, attempts to insert new model instances (which lack values
# for the removed fields) results in a warning about a lack of a default
# value. Because django does not have a mechanism for specifying the
# default value in the database, we must manually alter the table here.
if db.backend_name == 'mysql':
db.execute("ALTER TABLE edxval_profile MODIFY extension VARCHAR(10) DEFAULT 'mp4'")
db.execute("ALTER TABLE edxval_profile MODIFY width INT(10) UNSIGNED DEFAULT 1")
db.execute("ALTER TABLE edxval_profile MODIFY height INT(10) UNSIGNED DEFAULT 1")
def backwards(self, orm):
# Remove database-level defaults applied above
if db.backend_name == 'mysql':
db.execute("ALTER TABLE edxval_profile MODIFY extension VARCHAR(10)")
db.execute("ALTER TABLE edxval_profile MODIFY width INT(10) UNSIGNED")
db.execute("ALTER TABLE edxval_profile MODIFY height INT(10) UNSIGNED")
# Because the forward migration is non-destructive and simply alters the
# extension, width, and height columns of the Profile model to allow
# null values, values from before the forward migration will still be
# present in the table. The backward migration restores the non-null
# restriction to each column and provides dumb defaults for any profiles
# that were created between the application of the forward migration and
# backward migration.
db.alter_column('edxval_profile', 'width', self.gf('django.db.models.fields.PositiveIntegerField')(default=1))
db.alter_column('edxval_profile', 'extension', self.gf('django.db.models.fields.CharField')(default='mp4', max_length=10))
db.alter_column('edxval_profile', 'height', self.gf('django.db.models.fields.PositiveIntegerField')(default=1))
models = {
'edxval.coursevideo': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideo'},
'course_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'courses'", 'to': "orm['edxval.Video']"})
},
'edxval.encodedvideo': {
'Meta': {'object_name': 'EncodedVideo'},
'bitrate': ('django.db.models.fields.PositiveIntegerField', [], {}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'file_size': ('django.db.models.fields.PositiveIntegerField', [], {}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'profile': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'+'", 'to': "orm['edxval.Profile']"}),
'url': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'encoded_videos'", 'to': "orm['edxval.Video']"})
},
'edxval.profile': {
'Meta': {'object_name': 'Profile'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'profile_name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '50'})
},
'edxval.subtitle': {
'Meta': {'object_name': 'Subtitle'},
'content': ('django.db.models.fields.TextField', [], {'default': "''"}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'fmt': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'language': ('django.db.models.fields.CharField', [], {'max_length': '8', 'db_index': 'True'}),
'modified': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
'video': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'subtitles'", 'to': "orm['edxval.Video']"})
},
'edxval.video': {
'Meta': {'object_name': 'Video'},
'client_video_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '255', 'blank': 'True'}),
'created': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'duration': ('django.db.models.fields.FloatField', [], {}),
'edx_video_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'status': ('django.db.models.fields.CharField', [], {'max_length': '255', 'db_index': 'True'})
}
}
complete_apps = ['edxval']
...@@ -128,10 +128,8 @@ INSTALLED_APPS = ( ...@@ -128,10 +128,8 @@ INSTALLED_APPS = (
# 'django.contrib.admindocs', # 'django.contrib.admindocs',
# Third Party # Third Party
'south',
'django_nose', 'django_nose',
'rest_framework', 'rest_framework',
'debug_toolbar',
# Our App # Our App
'edxval', 'edxval',
......
...@@ -643,7 +643,7 @@ class GetVideoInfoTestWithHttpCalls(APIAuthTestCase): ...@@ -643,7 +643,7 @@ class GetVideoInfoTestWithHttpCalls(APIAuthTestCase):
""" """
Tests number of queries for a Video/EncodedVideo(1) pair Tests number of queries for a Video/EncodedVideo(1) pair
""" """
with self.assertNumQueries(8): with self.assertNumQueries(6):
api.get_video_info(constants.COMPLETE_SET_FISH.get("edx_video_id")) api.get_video_info(constants.COMPLETE_SET_FISH.get("edx_video_id"))
def test_get_info_queries_for_one_encoded_video(self): def test_get_info_queries_for_one_encoded_video(self):
...@@ -655,7 +655,7 @@ class GetVideoInfoTestWithHttpCalls(APIAuthTestCase): ...@@ -655,7 +655,7 @@ class GetVideoInfoTestWithHttpCalls(APIAuthTestCase):
url, constants.COMPLETE_SET_STAR, format='json' url, constants.COMPLETE_SET_STAR, format='json'
) )
self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
with self.assertNumQueries(6): with self.assertNumQueries(5):
api.get_video_info(constants.COMPLETE_SET_STAR.get("edx_video_id")) api.get_video_info(constants.COMPLETE_SET_STAR.get("edx_video_id"))
def test_get_info_queries_for_only_video(self): def test_get_info_queries_for_only_video(self):
......
...@@ -641,7 +641,7 @@ class VideoListTest(APIAuthTestCase): ...@@ -641,7 +641,7 @@ class VideoListTest(APIAuthTestCase):
Tests number of queries for a Video/EncodedVideo(2) pair Tests number of queries for a Video/EncodedVideo(2) pair
""" """
url = reverse('video-list') url = reverse('video-list')
with self.assertNumQueries(17): with self.assertNumQueries(15):
self.client.post(url, constants.COMPLETE_SET_FISH, format='json') self.client.post(url, constants.COMPLETE_SET_FISH, format='json')
def test_queries_for_single_encoded_videos(self): def test_queries_for_single_encoded_videos(self):
...@@ -649,7 +649,7 @@ class VideoListTest(APIAuthTestCase): ...@@ -649,7 +649,7 @@ class VideoListTest(APIAuthTestCase):
Tests number of queries for a Video/EncodedVideo(1) pair Tests number of queries for a Video/EncodedVideo(1) pair
""" """
url = reverse('video-list') url = reverse('video-list')
with self.assertNumQueries(14): with self.assertNumQueries(13):
self.client.post(url, constants.COMPLETE_SET_STAR, format='json') self.client.post(url, constants.COMPLETE_SET_STAR, format='json')
...@@ -690,11 +690,11 @@ class VideoDetailTest(APIAuthTestCase): ...@@ -690,11 +690,11 @@ class VideoDetailTest(APIAuthTestCase):
self.client.get("/edxval/videos/").data self.client.get("/edxval/videos/").data
response = self.client.post(url, constants.COMPLETE_SET_FISH, format='json') response = self.client.post(url, constants.COMPLETE_SET_FISH, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
with self.assertNumQueries(14): with self.assertNumQueries(12):
self.client.get("/edxval/videos/").data self.client.get("/edxval/videos/").data
response = self.client.post(url, constants.COMPLETE_SET_STAR, format='json') response = self.client.post(url, constants.COMPLETE_SET_STAR, format='json')
self.assertEqual(response.status_code, status.HTTP_201_CREATED) self.assertEqual(response.status_code, status.HTTP_201_CREATED)
with self.assertNumQueries(17): with self.assertNumQueries(14):
self.client.get("/edxval/videos/").data self.client.get("/edxval/videos/").data
......
django>=1.4,<1.5 django>=1.8,<1.9
djangorestframework>=3.1,<3.2 djangorestframework>=3.1,<3.2
enum34==1.0.4 enum34==1.0.4
lxml==3.3.6 lxml==3.3.6
South==1.0.1
-e git+https://github.com/edx/django-oauth2-provider.git@0.2.7-fork-edx-5#egg=django-oauth2-provider -e git+https://github.com/edx/django-oauth2-provider.git@0.2.7-fork-edx-5#egg=django-oauth2-provider
-e git+https://github.com/edx/django-rest-framework-oauth.git@f0b503fda8c254a38f97fef802ded4f5fe367f7a#egg=djangorestframework-oauth -e git+https://github.com/edx/django-rest-framework-oauth.git@f0b503fda8c254a38f97fef802ded4f5fe367f7a#egg=djangorestframework-oauth
...@@ -2,7 +2,9 @@ ...@@ -2,7 +2,9 @@
from setuptools import setup from setuptools import setup
PACKAGES = [ PACKAGES = [
'edxval' 'edxval',
'edxval.migrations',
'edxval.tests',
] ]
def is_requirement(line): def is_requirement(line):
...@@ -37,7 +39,7 @@ def load_requirements(*requirements_paths): ...@@ -37,7 +39,7 @@ def load_requirements(*requirements_paths):
setup( setup(
name='edxval', name='edxval',
version='0.0.6', version='0.0.8',
author='edX', author='edX',
url='http://github.com/edx/edx-val', url='http://github.com/edx/edx-val',
description='edx-val', description='edx-val',
......
django-nose==1.4.1 django-nose==1.4.1
coverage==3.7.1 coverage==3.7.1
mock==1.0.1 mock==1.0.1
django-debug-toolbar==1.2.1
pylint==1.3.0 pylint==1.3.0
ddt==0.8.0 ddt==0.8.0
...@@ -2,7 +2,6 @@ from django.conf import settings ...@@ -2,7 +2,6 @@ from django.conf import settings
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns( urlpatterns = patterns(
'', '',
...@@ -15,12 +14,3 @@ urlpatterns = patterns( ...@@ -15,12 +14,3 @@ urlpatterns = patterns(
# edx-val # edx-val
url(r'^edxval/', include('edxval.urls')) url(r'^edxval/', include('edxval.urls'))
) )
# We need to do explicit setup of the Django debug toolbar because autodiscovery
# causes problems when you mix debug toolbar >= 1.0 + django < 1.7, and the
# admin uses autodiscovery. See:
# http://django-debug-toolbar.readthedocs.org/en/1.0/installation.html#explicit-setup
if settings.DEBUG:
urlpatterns += patterns('',
url(r'^__debug__/', include('debug_toolbar.urls')),
)
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