mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
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:
parent
30e56f62ba
commit
626cca5f67
|
@ -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
|
Add these to your root URLconf if you're using the browsable API and
|
||||||
your API requires authentication:
|
your API requires authentication:
|
||||||
|
from django.urls import re_path
|
||||||
|
|
||||||
urlpatterns = [
|
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`.
|
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
|
from django.contrib.auth import views
|
||||||
|
|
||||||
app_name = 'rest_framework'
|
app_name = 'rest_framework'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^login/$', views.LoginView.as_view(template_name='rest_framework/login.html'), name='login'),
|
re_path(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'^logout/$', views.LogoutView.as_view(), name='logout'),
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user