Merge remote-tracking branch 'origin/dev' into dev

remotes/origin/hasaccess
Vitaly Baev 8 years ago
commit a1155eaf2c
  1. 3
      .gitignore
  2. 3
      api/v1/serializers/course.py
  3. 10
      apps/course/models.py

3
.gitignore vendored

@ -114,3 +114,6 @@ db.sqlite3
.vscode
/web/build
yarn.lock
package-lock.json

@ -12,6 +12,7 @@ from apps.content.models import (
Gallery, GalleryImage, ImageObject,
)
from .user import UserSerializer
from .mixins import DispatchContentMixin, DispatchGalleryMixin, DispatchMaterialMixin
@ -124,7 +125,6 @@ class CourseCreateSerializer(DispatchContentMixin,
materials = validated_data.pop('materials', [])
gallery = validated_data.pop('gallery', {})
author = validated_data.get('author', None)
print(author)
if not author:
validated_data['author'] = self.context['request'].user
course = super().create(validated_data)
@ -151,6 +151,7 @@ class CourseCreateSerializer(DispatchContentMixin,
class CourseSerializer(CourseCreateSerializer):
author = UserSerializer()
category = CategorySerializer()
materials = MaterialSerializer(many=True)
cover = ImageObjectSerializer()

@ -28,13 +28,17 @@ def default_slug():
class Course(BaseModel, DeactivatedMixin):
PENDING = 0
PUBLISHED = 1
ARCHIVED = 2
DRAFT = 0
PENDING = 1
PUBLISHED = 2
ARCHIVED = 3
DENIED = 4
STATUS_CHOICES = (
(DRAFT, 'Draft'),
(PENDING, 'Pending'),
(PUBLISHED, 'Published'),
(ARCHIVED, 'Archived'),
(DENIED, 'Denied')
)
slug = models.SlugField(
allow_unicode=True, default=default_slug,

Loading…
Cancel
Save