Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-val
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-val
Commits
b2285feb
Commit
b2285feb
authored
Sep 17, 2014
by
David Ormsbee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed name of model CourseVideos -> CourseVideo.
Django model names should be singular.
parent
4a8af859
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
19 deletions
+19
-19
edxval/admin.py
+2
-2
edxval/migrations/0001_initial.py
+10
-10
edxval/migrations/0002_default_profiles.py
+1
-1
edxval/models.py
+1
-1
edxval/serializers.py
+3
-3
edxval/tests/test_api.py
+2
-2
No files found.
edxval/admin.py
View file @
b2285feb
...
@@ -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
,
CourseVideo
s
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
(
CourseVideo
s
)
admin
.
site
.
register
(
CourseVideo
)
edxval/migrations/0001_initial.py
View file @
b2285feb
...
@@ -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 'CourseVideo
s
'
# Adding model 'CourseVideo'
db
.
create_table
(
'edxval_coursevideo
s
'
,
(
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'
,
[
'CourseVideo
s
'
])
db
.
send_create_signal
(
'edxval'
,
[
'CourseVideo'
])
# Adding unique constraint on 'CourseVideo
s
', fields ['course_id', 'video']
# Adding unique constraint on 'CourseVideo', fields ['course_id', 'video']
db
.
create_unique
(
'edxval_coursevideo
s
'
,
[
'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 'CourseVideo
s
', fields ['course_id', 'video']
# Removing unique constraint on 'CourseVideo', fields ['course_id', 'video']
db
.
delete_unique
(
'edxval_coursevideo
s
'
,
[
'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 'CourseVideo
s
'
# Deleting model 'CourseVideo'
db
.
delete_table
(
'edxval_coursevideo
s
'
)
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'
:
'CourseVideo
s
'
},
'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']"
})
...
...
edxval/migrations/0002_default_profiles.py
View file @
b2285feb
...
@@ -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'
:
'CourseVideo
s
'
},
'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']"
})
...
...
edxval/models.py
View file @
b2285feb
...
@@ -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
CourseVideo
s
(
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.
...
...
edxval/serializers.py
View file @
b2285feb
...
@@ -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
,
CourseVideo
s
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 CourseVideo
s
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
CourseVideo
s
(
course_id
=
data
)
return
CourseVideo
(
course_id
=
data
)
class
VideoSerializer
(
serializers
.
ModelSerializer
):
class
VideoSerializer
(
serializers
.
ModelSerializer
):
...
...
edxval/tests/test_api.py
View file @
b2285feb
...
@@ -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
,
CourseVideo
s
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'
CourseVideo
s
.
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
):
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment