import django
from django.conf import settings
from django.conf.urls import patterns, url
from django.core.urlresolvers import get_callable, reverse_lazy
from django.utils.translation import ugettext_lazy as _
from django.views.generic import RedirectView


auth_login_form = getattr(
    settings,
    'INCUNA_AUTH_LOGIN_FORM',
    'django.contrib.auth.forms.AuthenticationForm',
)
auth_form = get_callable(auth_login_form)

password_reset_form = getattr(
    settings,
    'INCUNA_PASSWORD_RESET_FORM',
    'incuna_auth.forms.CrispyPasswordResetForm',
)
reset_form = get_callable(password_reset_form)


urlpatterns = patterns(
    'django.contrib.auth.views',
    url(
        _(r'^login/$'),
        'login',
        {'authentication_form': auth_form},
        name='login',
    ),
    url(
        _(r'^logout/$'),
        'logout',
        {'template_name': 'registration/logout.html'},
        name='logout',
    ),
    # Change password (when logged in)
    url(
        _(r'^password/change/$'),
        'password_change',
        name='password_change',
    ),
    url(
        _(r'^password/change/done/$'),
        'password_change_done',
        name='password_change_done',
    ),
    # Reset password (when not logged in via unique email link)
    url(
        _(r'^password/reset/$'),
        'password_reset',
        {'password_reset_form': reset_form},
        name='password_reset',
    ),
    url(
        _(r'^password/reset/done/$'),
        'password_reset_done',
        name='password_reset_done',
    ),
    url(
        _(r'^password/reset/complete/$'),
        'password_reset_complete',
        name='password_reset_complete',
    ),
    url(
        _(r'^sso/$'),
        RedirectView.as_view(url=reverse_lazy('admin:admin_sso_openiduser_start')),
        name='sso_login',
    ),
)

if django.VERSION >= (1, 6):
    urlpatterns += patterns(
        'django.contrib.auth.views',
        url(
            _(
                r'^password/reset/confirm/' +
                r'(?P<uidb64>[0-9A-Za-z_\-]+)/' +
                r'(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
            ),
            'password_reset_confirm',
            name='password_reset_confirm',
        ),
    )

if django.VERSION < (1, 7):
    urlpatterns += patterns(
        'django.contrib.auth.views',
        url(
            _(
                r'^password/reset/confirm/' +
                r'(?P<uidb36>[0-9A-Za-z]{1,13})' +
                r'-(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/$'
            ),
            'password_reset_confirm',
            name='password_reset_confirm',
        ),
    )

@@ -73,21 +73,225 @@
 ort 
-patterns, url
+url%0Afrom django.contrib.auth.views import (%0A    login,%0A    logout,%0A    password_change,%0A    password_change_done,%0A    password_reset,%0A    password_reset_complete,%0A    password_reset_confirm,%0A    password_reset_done,%0A)
 %0Afro
@@ -820,50 +820,9 @@
 s = 
-patterns(%0A    'django.contrib.auth.views',
+%5B
 %0A   
@@ -859,23 +859,21 @@
         
-'
 login
-'
 ,%0A      
@@ -981,24 +981,22 @@
         
-'
 logout
-'
 ,%0A      
@@ -1156,33 +1156,32 @@
 ge/$'),%0A        
-'
 password_change'
@@ -1175,25 +1175,24 @@
 sword_change
-'
 ,%0A        na
@@ -1268,33 +1268,32 @@
 ne/$'),%0A        
-'
 password_change_
@@ -1292,25 +1292,24 @@
 _change_done
-'
 ,%0A        na
@@ -1448,33 +1448,32 @@
 et/$'),%0A        
-'
 password_reset',
@@ -1466,25 +1466,24 @@
 ssword_reset
-'
 ,%0A        %7B'
@@ -1602,33 +1602,32 @@
 ne/$'),%0A        
-'
 password_reset_d
@@ -1625,25 +1625,24 @@
 d_reset_done
-'
 ,%0A        na
@@ -1725,33 +1725,32 @@
 te/$'),%0A        
-'
 password_reset_c
@@ -1752,25 +1752,24 @@
 set_complete
-'
 ,%0A        na
@@ -1953,17 +1953,17 @@
 %0A    ),%0A
-)
+%5D
 %0A%0Aif dja
@@ -2008,54 +2008,9 @@
  += 
-patterns(%0A        'django.contrib.auth.views',
+%5B
 %0A   
@@ -2217,33 +2217,32 @@
  ),%0A            
-'
 password_reset_c
@@ -2239,33 +2239,32 @@
 rd_reset_confirm
-'
 ,%0A            na
@@ -2307,17 +2307,17 @@
  ),%0A    
-)
+%5D
 %0A%0Aif dja
@@ -2361,54 +2361,9 @@
  += 
-patterns(%0A        'django.contrib.auth.views',
+%5B
 %0A   
@@ -2580,17 +2580,16 @@
         
-'
 password
@@ -2594,33 +2594,32 @@
 rd_reset_confirm
-'
 ,%0A            na
@@ -2662,10 +2662,10 @@
  ),%0A    
-)
+%5D
 %0A

Remove use of "patterns" function in urls