Fix for django 1.4 compatibility

This commit is contained in:
Corey Oordt 2012-03-06 15:05:03 -05:00
parent d194974635
commit f3cc72a76b

View file

@ -136,11 +136,18 @@ class TreeEditor(admin.ModelAdmin):
pass
try:
cl = TreeChangeList(request, self.model, list_display,
self.list_display_links, self.list_filter, self.date_hierarchy,
self.search_fields, self.list_select_related,
self.list_per_page, self.list_max_show_all,
self.list_editable, self)
if django.VERSION[1] < 4:
params = (request, self.model, list_display,
self.list_display_links, self.list_filter, self.date_hierarchy,
self.search_fields, self.list_select_related,
self.list_per_page,self.list_editable, self)
else:
params = (request, self.model, list_display,
self.list_display_links, self.list_filter, self.date_hierarchy,
self.search_fields, self.list_select_related,
self.list_per_page, self.list_max_show_all,
self.list_editable, self)
cl = TreeChangeList(*params)
except IncorrectLookupParameters:
# Wacky lookup parameters were given, so redirect to the main
# changelist page, without parameters, and pass an 'invalid=1'