Commit b2285feb by David Ormsbee

Changed name of model CourseVideos -> CourseVideo.

Django model names should be singular.
parent 4a8af859
......@@ -3,10 +3,10 @@ Admin file for django app edxval.
"""
from django.contrib import admin
from .models import Video, Profile, EncodedVideo, Subtitle, CourseVideos
from .models import Video, Profile, EncodedVideo, Subtitle, CourseVideo
admin.site.register(Video)
admin.site.register(Profile)
admin.site.register(EncodedVideo)
admin.site.register(Subtitle)
admin.site.register(CourseVideos)
admin.site.register(CourseVideo)
......@@ -27,16 +27,16 @@ class Migration(SchemaMigration):
))
db.send_create_signal('edxval', ['Video'])
# Adding model 'CourseVideos'
db.create_table('edxval_coursevideos', (
# Adding model 'CourseVideo'
db.create_table('edxval_coursevideo', (
('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'])),
))
db.send_create_signal('edxval', ['CourseVideos'])
db.send_create_signal('edxval', ['CourseVideo'])
# Adding unique constraint on 'CourseVideos', fields ['course_id', 'video']
db.create_unique('edxval_coursevideos', ['course_id', 'video_id'])
# Adding unique constraint on 'CourseVideo', fields ['course_id', 'video']
db.create_unique('edxval_coursevideo', ['course_id', 'video_id'])
# Adding model 'EncodedVideo'
db.create_table('edxval_encodedvideo', (
......@@ -65,8 +65,8 @@ class Migration(SchemaMigration):
def backwards(self, orm):
# Removing unique constraint on 'CourseVideos', fields ['course_id', 'video']
db.delete_unique('edxval_coursevideos', ['course_id', 'video_id'])
# Removing unique constraint on 'CourseVideo', fields ['course_id', 'video']
db.delete_unique('edxval_coursevideo', ['course_id', 'video_id'])
# Deleting model 'Profile'
db.delete_table('edxval_profile')
......@@ -74,8 +74,8 @@ class Migration(SchemaMigration):
# Deleting model 'Video'
db.delete_table('edxval_video')
# Deleting model 'CourseVideos'
db.delete_table('edxval_coursevideos')
# Deleting model 'CourseVideo'
db.delete_table('edxval_coursevideo')
# Deleting model 'EncodedVideo'
db.delete_table('edxval_encodedvideo')
......@@ -86,7 +86,7 @@ class Migration(SchemaMigration):
models = {
'edxval.coursevideos': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideos'},
'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']"})
......
......@@ -25,7 +25,7 @@ class Migration(DataMigration):
models = {
'edxval.coursevideos': {
'Meta': {'unique_together': "(('course_id', 'video'),)", 'object_name': 'CourseVideos'},
'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']"})
......
......@@ -86,7 +86,7 @@ class Video(models.Model):
return self.edx_video_id
class CourseVideos(models.Model):
class CourseVideo(models.Model):
"""
Model for the course_id associated with the video content.
......
......@@ -7,7 +7,7 @@ EncodedVideoSerializer which uses the profile_name as it's profile field.
from rest_framework import serializers
from django.core.exceptions import ValidationError
from edxval.models import Profile, Video, EncodedVideo, Subtitle, CourseVideos
from edxval.models import Profile, Video, EncodedVideo, Subtitle, CourseVideo
class ProfileSerializer(serializers.ModelSerializer):
......@@ -86,14 +86,14 @@ class SubtitleSerializer(serializers.ModelSerializer):
class CourseSerializer(serializers.RelatedField):
"""
Field for CourseVideos
Field for CourseVideo
"""
def to_native(self, value):
return value.course_id
def from_native(self, data):
if data:
return CourseVideos(course_id=data)
return CourseVideo(course_id=data)
class VideoSerializer(serializers.ModelSerializer):
......
......@@ -12,7 +12,7 @@ from django.core.exceptions import ValidationError
from rest_framework import status
from ddt import ddt, data
from edxval.models import Profile, Video, EncodedVideo, CourseVideos
from edxval.models import Profile, Video, EncodedVideo, CourseVideo
from edxval import api as api
from edxval.api import ValCannotCreateError
from edxval.serializers import VideoSerializer
......@@ -139,7 +139,7 @@ class GetVideoInfoTest(TestCase):
**constants.ENCODED_VIDEO_DICT_DESKTOP
)
self.course_id = 'test-course'
CourseVideos.objects.create(video=video, course_id=self.course_id)
CourseVideo.objects.create(video=video, course_id=self.course_id)
def test_get_video_found(self):
"""
......
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