Implement Djoser library to handle users

This commit is contained in:
Francesco Esposito 2019-11-26 11:40:45 +01:00
parent a181de664f
commit eb488c8827
3 changed files with 14 additions and 13 deletions

View File

@ -1,8 +1,10 @@
astroid==2.3.3
Django==2.2.7
django-cors-headers==3.2.0
django-templated-mail==1.1.1
djangorestframework==3.10.3
djangorestframework-simplejwt==4.3.0
djoser==2.0.3
isort==4.3.21
lazy-object-proxy==1.4.3
mccabe==0.6.1

View File

@ -38,6 +38,7 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
'djoser',
'corsheaders',
'segnalibre_app'
]
@ -137,3 +138,7 @@ REST_FRAMEWORK = {
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
'PAGE_SIZE': 10
}
SIMPLE_JWT = {
'AUTH_HEADER_TYPES': ('JWT'),
}

View File

@ -1,18 +1,12 @@
from django.urls import path, include
from django.conf.urls import url
from . import views
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
TokenVerifyView)
prefix = 'v1/'
urlpatterns = [
path(prefix + 'users/', views.UserList.as_view()),
path(prefix + 'books/', views.BookList.as_view()),
path(prefix +'books/<int:pk>/', views.BookDetail.as_view()),
path('api-auth/', include('rest_framework.urls')),
path(prefix + 'auth/token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path(prefix + 'auth/refresh', TokenRefreshView.as_view(), name='token_refresh'),
path(prefix + 'auth/verify', TokenVerifyView.as_view(), name='token_verify')
url(r'^v1/auth/', include('djoser.urls')),
url(r'^v1/auth/', include('djoser.urls.jwt')),
path('v1/books/', views.BookList.as_view()),
path('v1/books/<int:pk>/', views.BookDetail.as_view()),
#path('api-auth/', include('rest_framework.urls')),
]