Fakultas Ilmu Komputer UI

urls.py 2.12 KB
Newer Older
Zamil Majdy's avatar
Zamil Majdy committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
"""djangoreact URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
16
from django.conf import settings
17
18
from django.conf.urls import include
from django.conf.urls import url
19
from django.conf.urls.static import static
Zamil Majdy's avatar
Zamil Majdy committed
20
from django.contrib import admin
21
from rest_framework import routers
22
23
from rest_framework_swagger.views import get_swagger_view

24
from core import apps
25
from core.views.accounts import StudentViewSet, CompanyViewSet, SupervisorViewSet, UserViewSet, LoginViewSet
26
from core.views.vacancies import VacancyViewSet, BookmarkedVacancyByStudentViewSet, ApplicationViewSet
Zamil Majdy's avatar
Zamil Majdy committed
27

28
schema_view = get_swagger_view()
29
30
router = routers.DefaultRouter()
router.register(r'users', UserViewSet)
31
32
33
router.register(r'students', StudentViewSet)
router.register(r'companies', CompanyViewSet)
router.register(r'supervisors', SupervisorViewSet)
34
router.register(r'login', LoginViewSet)
35
router.register(r'vacancies', VacancyViewSet)
36
37
router.register(r'students/(?P<student_id>\d+)/bookmarked-vacancies', BookmarkedVacancyByStudentViewSet,
                base_name='bookmarked-vacancy-list')
38
router.register(r'students/(?P<student_id>\d+)/applied-vacancies', ApplicationViewSet,
39
40
                base_name='applications')

Zamil Majdy's avatar
Zamil Majdy committed
41

42
43
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns += [
44
    url(r'^silk/', include('silk.urls', namespace='silk')),
45
    url(r'^api/api-auth/', include('rest_framework.urls', namespace='rest_framework')),
46
    url(r'^api$', schema_view),
47
    url(r"^api/", include(router.urls)),
Zamil Majdy's avatar
Zamil Majdy committed
48
    url(r'^admin/', admin.site.urls),
49
    url(r'', apps.index, name="index"),
Zamil Majdy's avatar
Zamil Majdy committed
50
]
51
52