diff --git a/.gitignore b/.gitignore index 3cdd2890..38adbfe2 100644 --- a/.gitignore +++ b/.gitignore @@ -114,3 +114,6 @@ db.sqlite3 .vscode /web/build + +yarn.lock +package-lock.json \ No newline at end of file diff --git a/api/v1/serializers/course.py b/api/v1/serializers/course.py index ed30182b..ac14f50a 100644 --- a/api/v1/serializers/course.py +++ b/api/v1/serializers/course.py @@ -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() diff --git a/apps/course/models.py b/apps/course/models.py index b0a2045d..be1637a3 100644 --- a/apps/course/models.py +++ b/apps/course/models.py @@ -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,