mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Fixing a few minor Django 1.5 incompatibilities
This commit is contained in:
parent
8ce56e8190
commit
c6f122d724
3 changed files with 17 additions and 7 deletions
|
|
@ -1,13 +1,23 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls import patterns, url
|
||||
from .models import Category
|
||||
|
||||
try:
|
||||
from django.views.generic import DetailView, ListView
|
||||
except ImportError:
|
||||
try:
|
||||
from cbv import DetailView, ListView
|
||||
except ImportError:
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
raise ImproperlyConfigured("For older versions of Django, you need django-cbv.")
|
||||
|
||||
|
||||
categorytree_dict = {
|
||||
'queryset': Category.objects.filter(level=0)
|
||||
}
|
||||
|
||||
urlpatterns = patterns('django.views.generic.list_detail',
|
||||
urlpatterns = patterns('',
|
||||
url(
|
||||
r'^$', 'object_list', categorytree_dict, name='categories_tree_list'
|
||||
r'^$', ListView.as_view(**categorytree_dict), name='categories_tree_list'
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ CATEGORIES_SETTINGS = {
|
|||
},
|
||||
}
|
||||
|
||||
if django.VERSION[1] == 4:
|
||||
if django.VERSION[1] >= 4:
|
||||
from settings14 import *
|
||||
if django.VERSION[1] == 3:
|
||||
from settings13 import *
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from django.conf.urls.defaults import *
|
||||
from django.conf.urls import patterns, include
|
||||
|
||||
# Uncomment the next two lines to enable the admin:
|
||||
from django.contrib import admin
|
||||
|
|
@ -13,7 +13,7 @@ urlpatterns = patterns('',
|
|||
# Example:
|
||||
# (r'^sample/', include('sample.foo.urls')),
|
||||
|
||||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
|
||||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
|
||||
# to INSTALLED_APPS to enable admin documentation:
|
||||
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
|
||||
|
|
@ -32,4 +32,4 @@ urlpatterns = patterns('',
|
|||
(r'^static/(?P<path>.*)$', 'django.views.static.serve',
|
||||
{'document_root': os.path.join(ROOT_PATH, 'example', 'static')}),
|
||||
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue