diff options
Diffstat (limited to 'ishtar_common/admin.py')
-rw-r--r-- | ishtar_common/admin.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py index a803c64cc..58096b0cd 100644 --- a/ishtar_common/admin.py +++ b/ishtar_common/admin.py @@ -372,21 +372,19 @@ class ChangeParentForm(forms.Form): change_parent = forms.ChoiceField(label=_("Change parent"), choices=[]) def __init__(self, choices, post=None, files=None): - if post: - super(ChangeParentForm, self).__init__(post, files) - else: - super(ChangeParentForm, self).__init__() + super(ChangeParentForm, self).__init__(post, files) self.fields["change_parent"].choices = choices class ChangeParentAdmin: def get_actions(self, request): action_dct = super(ChangeParentAdmin, self).get_actions(request) - action_dct["change_parent_selected"] = ( - self.change_parent_admin, - "change_parent_selected", - _("Change parent of selected item(s)"), - ) + if hasattr(self.model, "parent"): + action_dct["change_parent_selected"] = ( + self.change_parent_admin, + "change_parent_selected", + _("Change parent of selected item(s)"), + ) return action_dct def change_parent_admin(self, modeladmin, request, queryset): |