try:
    from django.conf.urls import url
except ImportError:
    from django.conf.urls.defaults import patterns, url, handler404, handler500

from django.http import HttpResponse
from django.shortcuts import render
from django.contrib.auth.views import login

from testapp_tests.views import check_password, search, set_session, \
    protected, redirect_to_protected, remove_prefix_redirect, cookie_test \


def simple_method_test(request):
    return HttpResponse(str(request.method))


def simple_template_render(request, template_name):
    return render(request, template_name, {
        'user': request.user,
        'foo': ('a', 'b', 'c'),
        'bar': True,
        'spam': None,
    })


urlpatterns = (
    url(r'^$', simple_method_test, name='simple-method-test'),
    url(r'^template/(.*)$', simple_template_render, name='simple-template-test'),
    url(r'^check-password/$', check_password, name='check_password'),
    url(r'^search/$', search, name='search'),
    url(r'^login/$', login, name='auth_login'),
    url(r'^set-session/$', set_session, name='set_session'),
    url(r'^protected/$', protected, name='protected'),
    url(r'^redirect-to-protected/$', redirect_to_protected, name='redirect-to-protected'),
    url(r'^remove-prefix-redirect/(.*)/$', remove_prefix_redirect, name='remove-prefix-redirect'),
    url(r'^cookie-test/$', cookie_test, name='cookie_test'),
)

@@ -101,45 +101,11 @@
 ort 
-patterns, url, handler404, handler500
+url
 %0A%0Afr
@@ -178,52 +178,8 @@
 nder
-%0Afrom django.contrib.auth.views import login
 %0A%0Afr
@@ -320,18 +320,190 @@
 kie_test
- %5C
+%0A%0Atry:%0A    from django.contrib.auth.views import login%0Aexcept ImportError:%0A    # django 2+%0A    from django.contrib.auth.views import LoginView%0A    login = LoginView.as_view()
 %0A%0A%0Adef s
@@ -917,16 +917,24 @@
 _render,
+%0A       
  name='s
@@ -1272,16 +1272,24 @@
 cted/$',
+%0A       
  redirec
@@ -1377,16 +1377,24 @@
 (.*)/$',
+%0A       
  remove_

use LoginView for django 2+