Added Django REST but have some bugs
This commit is contained in:
@@ -36,6 +36,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django_registration',
|
||||
'rest_framework',
|
||||
'main',
|
||||
]
|
||||
|
||||
@@ -183,3 +184,11 @@ ZENDESK_ROLES = {
|
||||
'engineer': 360005209000,
|
||||
'light_agent': 360005208980,
|
||||
}
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
# Use Django's standard `django.contrib.auth` permissions,
|
||||
# or allow read-only access for unauthenticated users.
|
||||
'DEFAULT_PERMISSION_CLASSES': [
|
||||
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
|
||||
]
|
||||
}
|
||||
|
||||
@@ -17,15 +17,16 @@ from django.contrib import admin
|
||||
from django.contrib.auth import views as auth_views
|
||||
from django.urls import path, include
|
||||
from main.views import work_page, work_hand_over, work_become_engineer, AdminPageView
|
||||
|
||||
from main.views import main_page, profile_page, CustomRegistrationView, CustomLoginView
|
||||
from main.urls import router
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls, name='admin'),
|
||||
path('', main_page, name='index'),
|
||||
path('accounts/profile/', profile_page, name='profile'),
|
||||
path('accounts/register/', CustomRegistrationView.as_view(), name='registration'),
|
||||
path('accounts/login/', CustomLoginView.as_view(extra_context={}), name='login',), # TODO add extra context
|
||||
path('accounts/login/', CustomLoginView.as_view(extra_context={}), name='login', ), # TODO add extra context
|
||||
path('accounts/', include('django.contrib.auth.urls')),
|
||||
path('accounts/', include('django_registration.backends.one_step.urls')),
|
||||
path('work/<int:id>', work_page, name="work"),
|
||||
@@ -34,7 +35,7 @@ urlpatterns = [
|
||||
path('accounts/', include('django_registration.backends.activation.urls')),
|
||||
path('accounts/login/', include('django.contrib.auth.urls')),
|
||||
path('control/', AdminPageView.as_view(), name='control')
|
||||
]
|
||||
]
|
||||
|
||||
urlpatterns += [
|
||||
path(
|
||||
@@ -58,3 +59,8 @@ urlpatterns += [
|
||||
name='password_reset_complete'
|
||||
),
|
||||
]
|
||||
|
||||
# Django REST
|
||||
urlpatterns += [
|
||||
path('api/', include(router.urls))
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user