Commit 8b883238 authored by Matheus Miranda's avatar Matheus Miranda

Update course serializer

parent a95410cd
......@@ -41,7 +41,7 @@ class CourseSerializer(serializers.ModelSerializer):
"thumbnail_url", "home_thumbnail_url", "home_position",
"start_date", "home_published", "authors_names", "has_started",
"min_percent_to_complete", "is_user_assistant", "is_user_coordinator",
"is_assistant_or_coordinator", 'professors', 'track',)
"is_assistant_or_coordinator", 'professors', 'track', 'forum_id')
@staticmethod
def get_home_thumbnail_url(obj):
......
......@@ -5,6 +5,7 @@ from rest_framework import routers
from .views import (
CourseViewSet, BaseCourseProfessorViewSet,
CourseBySlugViewSet,
ProfessorMessageViewSet,
ProfessorMessageReadViewSet,
ProfessorGlobalMessageViewSet,
......@@ -44,7 +45,7 @@ router.register(r'course', CourseViewSet, base_name='course')
router.register(r'my-courses', MyCoursesViewSet, base_name='my-courses')
router.register(r'course_material', CourseMaterialViewSet, base_name='course_material')
router.register(r'course_material_file', CourseMaterialFileViewSet, base_name='course_material_file')
router.register(r'course-by-slug', CourseBySlugViewSet, base_name='course_by_slug'),
# Workspaces
router.register(r'workspaces', WorkspaceViewSet)
......@@ -75,7 +76,10 @@ router.register(r'classroom', ClassroomViewSet, base_name='classroom')
router.register(r'event', EventViewSet, base_name='event')
# Stats
router.register(r'user-activities', UserActivitiesViewSet, base_name='user-activities')
router.register(r'user-activities', UserActivitiesViewSet, base_name='user-activities'),
# I18n
url(r'^api/i18n/', include('django.conf.urls.i18n')),
app_name = 'courses'
urlpatterns = [
......
......@@ -111,6 +111,14 @@ class MyCoursesViewSet(viewsets.ModelViewSet):
return queryset
class CourseBySlugViewSet(viewsets.ModelViewSet):
model = Course
queryset = Course.objects.all()
serializer_class = CourseSerializer
permission_classes = (IsAuthenticated,)
lookup_field = 'slug'
class BaseCourseProfessorViewSet(viewsets.ModelViewSet):
model = CourseProfessor
......
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