Changed url() to re_path() for newest updates

I have changed url() function to re_path() function for Django 2.2 version updates because it is better. I have also updated imported modules from django.conf.urls import django.urls
This commit is contained in:
Manoj Tyagi 2019-10-04 01:03:05 +05:30 committed by GitHub
parent 30e56f62ba
commit 626cca5f67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,19 +3,20 @@ Login and logout views for the browsable API.
Add these to your root URLconf if you're using the browsable API and
your API requires authentication:
from django.urls import re_path
urlpatterns = [
...
url(r'^auth/', include('rest_framework.urls'))
re_path(r'^auth/', include('rest_framework.urls'))
]
You should make sure your authentication settings include `SessionAuthentication`.
"""
from django.conf.urls import url
from django.urls import re_path
from django.contrib.auth import views
app_name = 'rest_framework'
urlpatterns = [
url(r'^login/$', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),
url(r'^logout/$', views.LogoutView.as_view(), name='logout'),
re_path(r'^login/$', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),
re_path(r'^logout/$', views.LogoutView.as_view(), name='logout'),
]