Skip to content

Commit

Permalink
[-] Fixed some tree editor and generic collection issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jsoa authored and coordt committed Jun 9, 2015
1 parent e0676d4 commit 4f51f96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions categories/editor/tree_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,9 @@ def changelist_view(self, request, extra_context=None, *args, **kwargs):
extra_context = extra_context or {}
extra_context['EDITOR_MEDIA_PATH'] = settings.MEDIA_PATH
extra_context['EDITOR_TREE_INITIAL_STATE'] = settings.TREE_INITIAL_STATE
if django.VERSION[1] >= 2:
return super(TreeEditor, self).changelist_view(
request, extra_context, *args, **kwargs)
else:
return self.old_changelist_view(request, extra_context)

# FIXME
return self.old_changelist_view(request, extra_context)

def get_queryset(self, request):
"""
Expand Down
8 changes: 4 additions & 4 deletions categories/genericcollection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
class GenericCollectionInlineModelAdmin(admin.options.InlineModelAdmin):
ct_field = "content_type"
ct_fk_field = "object_id"

def __init__(self, parent_model, admin_site):
super(GenericCollectionInlineModelAdmin, self).__init__(parent_model, admin_site)
ctypes = ContentType.objects.all().order_by('id').values_list('id', 'app_label', 'model')
elements = ["%s: '%s/%s'" % (x, y, z) for x, y, z in ctypes]
self.content_types = "{%s}" % ",".join(elements)
def get_formset(self, request, obj=None):
result = super(GenericCollectionInlineModelAdmin, self).get_formset(request, obj)

def get_formset(self, request, obj=None, **kwargs):
result = super(GenericCollectionInlineModelAdmin, self).get_formset(request, obj, **kwargs)
result.content_types = self.content_types
result.ct_fk_field = self.ct_fk_field
return result
Expand Down

0 comments on commit 4f51f96

Please sign in to comment.