urls.py 3.55 KB
Newer Older
1
from django.conf.urls import url, include
Laury Bueno's avatar
Laury Bueno committed
2 3
from django.views.generic import TemplateView

4
from rest_framework import routers
Laury Bueno's avatar
Laury Bueno committed
5

6 7
from .views import (
    CourseViewSet, BaseCourseProfessorViewSet,
Matheus Miranda's avatar
Matheus Miranda committed
8
    CourseBySlugViewSet,
9 10 11
    ProfessorMessageViewSet,
    ProfessorMessageReadViewSet,
    ProfessorGlobalMessageViewSet,
Matheus Miranda's avatar
Matheus Miranda committed
12
    MyCoursesViewSet, LessonViewSet
13
)
14
from .course_material.views import CourseMaterialViewSet, CourseMaterialFileViewSet
15
from .import_export.views import ExportCourseView, ImportCourseView
Bruno Martin's avatar
Bruno Martin committed
16 17 18 19
from courses.workspaces.views import (
    WorkspaceViewSet,
    WorkspaceGroupViewSet,
    WorkspaceGroupAdminViewSet,
20 21
)
from courses.classes.views import (
Bruno Martin's avatar
Bruno Martin committed
22
    ClassViewSet,
23
    BasicClassViewSet,
Bruno Martin's avatar
Bruno Martin committed
24
)
25 26 27 28
from courses.reports.views import (
    SummaryViewSet,
    UsersByGroupViewSet,
    UsersByClassViewSet,
Matheus Miranda's avatar
Matheus Miranda committed
29 30
    UserStatsViewSet,
    UserAccessView
31
)
Bruno Martin's avatar
Bruno Martin committed
32 33 34
from courses.classroom.views import (
    BasicClassroomViewSet,
    ClassroomViewSet,
35
    EventViewSet,
Bruno Martin's avatar
Bruno Martin committed
36
)
37 38
from courses.stats.views import (
    UserActionsView,
39
    UserActivitiesViewSet
40 41
)

Bruno Martin's avatar
Bruno Martin committed
42

43
router = routers.SimpleRouter(trailing_slash=False)
44
router.register(r'course', CourseViewSet, base_name='course')
45
router.register(r'my-courses', MyCoursesViewSet, base_name='my-courses')
46 47
router.register(r'course_material', CourseMaterialViewSet, base_name='course_material')
router.register(r'course_material_file', CourseMaterialFileViewSet, base_name='course_material_file')
Matheus Miranda's avatar
Matheus Miranda committed
48
router.register(r'course-by-slug', CourseBySlugViewSet, base_name='course_by_slug'),
49

Matheus Miranda's avatar
Matheus Miranda committed
50 51 52
# Lessons
router.register(r'course-lessons/(?P<course_id>[1-9][0-9]*)', LessonViewSet, base_name='lessons')

Bruno Martin's avatar
Bruno Martin committed
53 54 55 56 57
# Workspaces
router.register(r'workspaces', WorkspaceViewSet)
router.register(r'group', WorkspaceGroupViewSet, base_name='group')
router.register(r'group_admin', WorkspaceGroupAdminViewSet, base_name='group_admin')
router.register(r'class', ClassViewSet)
58
router.register(r'class_basic', BasicClassViewSet)
Bruno Martin's avatar
Bruno Martin committed
59

60 61 62 63 64 65
# Reports
# router.register(r'contract', views.ContractViewSet)
# router.register(r'class', views.ClassViewSet)
router.register(r'summary', SummaryViewSet, base_name='summary')
router.register(r'users-by-group', UsersByGroupViewSet, base_name='users-by-group')
router.register(r'users-by-class', UsersByClassViewSet, base_name='users-by-class')
66
router.register(r'user-reports', UserStatsViewSet, base_name='user-reports')
67

68
# router.register(r'course_carousel', views.CarouselCourseView, base_name='course_carousel')
69 70

#Professor
71
router.register(r'course_professor_basic', BaseCourseProfessorViewSet, base_name='course_professor')
72 73 74
router.register(r'professor_message', ProfessorMessageViewSet, base_name='professor_message')
router.register(r'professor_message_global', ProfessorGlobalMessageViewSet, base_name='professor_message_global')
router.register(r'professor_message_read', ProfessorMessageReadViewSet, base_name='professor_message_read')
75

Bruno Martin's avatar
Bruno Martin committed
76 77 78
# Classroom
router.register(r'classrooms', BasicClassroomViewSet, base_name='classrooms')
router.register(r'classroom', ClassroomViewSet, base_name='classroom')
79
router.register(r'event', EventViewSet, base_name='event')
Bruno Martin's avatar
Bruno Martin committed
80

81
# Stats
Matheus Miranda's avatar
Matheus Miranda committed
82 83
router.register(r'user-activities', UserActivitiesViewSet, base_name='user-activities'),

84
app_name = 'courses'
85
urlpatterns = [
86 87 88
    # Stats (Activity Stream related functionality)
    url(r'^stats/', include('courses.stats.urls')),

89 90 91
    url(r'^course/(?P<course_id>[1-9][0-9]*)/export/$', ExportCourseView.as_view(), name="course_export"),
    url(r'^course/import/$', ImportCourseView.as_view(), name="course_import"),
    url(r'^', include(router.urls)),
Matheus Miranda's avatar
Matheus Miranda committed
92 93

    url(r'^user-access', UserAccessView.as_view(), name='user-access')
94
]