mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-05-20 07:43:47 +03:00
Revert "Move django.contrib.auth import out of compat."
This reverts commit d4d9cc1d53
.
This commit is contained in:
parent
d4d9cc1d53
commit
7d0fa02dc0
|
@ -11,6 +11,7 @@ import inspect
|
||||||
import django
|
import django
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib.auth import views
|
||||||
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
from django.core.exceptions import ImproperlyConfigured, ValidationError
|
||||||
from django.core.validators import \
|
from django.core.validators import \
|
||||||
MaxLengthValidator as DjangoMaxLengthValidator
|
MaxLengthValidator as DjangoMaxLengthValidator
|
||||||
|
@ -333,3 +334,11 @@ def authenticate(request=None, **credentials):
|
||||||
else:
|
else:
|
||||||
return authenticate(request=request, **credentials)
|
return authenticate(request=request, **credentials)
|
||||||
|
|
||||||
|
if django.VERSION < (1, 11):
|
||||||
|
login = views.login
|
||||||
|
login_kwargs = {'template_name': 'rest_framework/login.html'}
|
||||||
|
logout = views.logout
|
||||||
|
else:
|
||||||
|
login = views.LoginView.as_view(template_name='rest_framework/login.html')
|
||||||
|
login_kwargs = {}
|
||||||
|
logout = views.LogoutView.as_view()
|
||||||
|
|
|
@ -15,17 +15,8 @@ and you should make sure your authentication settings include `SessionAuthentica
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from django.contrib.auth import views
|
|
||||||
|
|
||||||
if django.VERSION < (1, 11):
|
|
||||||
login = views.login
|
|
||||||
login_kwargs = {'template_name': 'rest_framework/login.html'}
|
|
||||||
logout = views.logout
|
|
||||||
else:
|
|
||||||
login = views.LoginView.as_view(template_name='rest_framework/login.html')
|
|
||||||
login_kwargs = {}
|
|
||||||
logout = views.LogoutView.as_view()
|
|
||||||
|
|
||||||
|
from rest_framework.compat import login, login_kwargs, logout
|
||||||
|
|
||||||
app_name = 'rest_framework'
|
app_name = 'rest_framework'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user