from django import VERSION

from .views import AutocompleteView, RegistryView

try:
    from django.conf.urls import patterns, url
except ImportError:
    # Django < 1.5
    from django.conf.urls.defaults import patterns, url

urlpatterns = [
    url(r'^(?P<autocomplete>[-\w]+)/$',
        AutocompleteView.as_view(),
        name='autocomplete_light_autocomplete'
    ),
    url(r'^$',
        RegistryView.as_view(),
        name='autocomplete_light_registry'
    ),
]

if VERSION < (1, 9):
    urlpatterns = patterns('', *urlpatterns)

from django import VERSION

from .views import AutocompleteView, RegistryView

if VERSION > (1, 9):
    from django.conf.urls import url
else:
    try:
        from django.conf.urls import patterns, url
    except ImportError:
        # Django < 1.5
        from django.conf.urls.defaults import patterns, url

urlpatterns = [
    url(r'^(?P<autocomplete>[-\w]+)/$',
        AutocompleteView.as_view(),
        name='autocomplete_light_autocomplete'
    ),
    url(r'^$',
        RegistryView.as_view(),
        name='autocomplete_light_registry'
    ),
]

if VERSION < (1, 9):
    urlpatterns = patterns('', *urlpatterns)

Fix Django 1.9 import error
Fix Django 1.9 import error

  from django import VERSION
  
  from .views import AutocompleteView, RegistryView
  
- try:
+ if VERSION > (1, 9):
+     from django.conf.urls import url
+ else:
+     try:
-     from django.conf.urls import patterns, url
+         from django.conf.urls import patterns, url
- except ImportError:
+     except ImportError:
-     # Django < 1.5
+         # Django < 1.5
-     from django.conf.urls.defaults import patterns, url
+         from django.conf.urls.defaults import patterns, url
  
  urlpatterns = [
      url(r'^(?P<autocomplete>[-\w]+)/$',
          AutocompleteView.as_view(),
          name='autocomplete_light_autocomplete'
      ),
      url(r'^$',
          RegistryView.as_view(),
          name='autocomplete_light_registry'
      ),
  ]
  
  if VERSION < (1, 9):
      urlpatterns = patterns('', *urlpatterns)
  
Fix Django 1.9 import error
## Code Before:
from django import VERSION

from .views import AutocompleteView, RegistryView

try:
    from django.conf.urls import patterns, url
except ImportError:
    # Django < 1.5
    from django.conf.urls.defaults import patterns, url

urlpatterns = [
    url(r'^(?P<autocomplete>[-\w]+)/$',
        AutocompleteView.as_view(),
        name='autocomplete_light_autocomplete'
    ),
    url(r'^$',
        RegistryView.as_view(),
        name='autocomplete_light_registry'
    ),
]

if VERSION < (1, 9):
    urlpatterns = patterns('', *urlpatterns)

## Instruction:
Fix Django 1.9 import error
## Code After:
from django import VERSION

from .views import AutocompleteView, RegistryView

if VERSION > (1, 9):
    from django.conf.urls import url
else:
    try:
        from django.conf.urls import patterns, url
    except ImportError:
        # Django < 1.5
        from django.conf.urls.defaults import patterns, url

urlpatterns = [
    url(r'^(?P<autocomplete>[-\w]+)/$',
        AutocompleteView.as_view(),
        name='autocomplete_light_autocomplete'
    ),
    url(r'^$',
        RegistryView.as_view(),
        name='autocomplete_light_registry'
    ),
]

if VERSION < (1, 9):
    urlpatterns = patterns('', *urlpatterns)
