diff --git a/tastypie_swagger/urls.py b/tastypie_swagger/urls.py index 1d37b53..46e5935 100644 --- a/tastypie_swagger/urls.py +++ b/tastypie_swagger/urls.py @@ -1,13 +1,19 @@ +from .views import SwaggerView, ResourcesView, SchemaView try: - from django.conf.urls import patterns, include, url -except ImportError: - from django.conf.urls.defaults import patterns, include, url + from django.conf.urls import include, url -from .views import SwaggerView, ResourcesView, SchemaView + urlpatterns = [ + url(r'^$', SwaggerView.as_view(), name='index'), + url(r'^resources/$', ResourcesView.as_view(), name='resources'), + url(r'^schema/(?P\S+)$', SchemaView.as_view()), + url(r'^schema/$', SchemaView.as_view(), name='schema'), + ] +except ImportError: + from django.conf.urls.defaults import patterns, include, url -urlpatterns = patterns('', - url(r'^$', SwaggerView.as_view(), name='index'), - url(r'^resources/$', ResourcesView.as_view(), name='resources'), - url(r'^schema/(?P\S+)$', SchemaView.as_view()), - url(r'^schema/$', SchemaView.as_view(), name='schema'), -) + urlpatterns = patterns('', + url(r'^$', SwaggerView.as_view(), name='index'), + url(r'^resources/$', ResourcesView.as_view(), name='resources'), + url(r'^schema/(?P\S+)$', SchemaView.as_view()), + url(r'^schema/$', SchemaView.as_view(), name='schema'), + )