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