Skip to content
Snippets Groups Projects
Commit 56d3ab18 authored by Tomáš Valenta's avatar Tomáš Valenta
Browse files

fix inline ordering & permission-based viewing

parent 46872fef
No related branches found
No related tags found
No related merge requests found
...@@ -272,7 +272,10 @@ class ContractAdmin( ...@@ -272,7 +272,10 @@ class ContractAdmin(
"publishing_rejection_comment", "publishing_rejection_comment",
) )
if request.user.has_perm("approve", self): if (
obj is not None
and request.user.has_perm("approve", obj)
):
fieldsets.insert( fieldsets.insert(
5, 5,
("Schválení", {"fields": ["is_approved"]}), ("Schválení", {"fields": ["is_approved"]}),
......
This diff is collapsed.
...@@ -24,12 +24,16 @@ def get_fieldsets_and_inlines(context): ...@@ -24,12 +24,16 @@ def get_fieldsets_and_inlines(context):
else [] else []
) )
): ):
if choice == FieldsetInlineOrder.FIELDSET: try:
fieldsets_and_inlines.append( if choice == FieldsetInlineOrder.FIELDSET:
(FieldsetInlineOrder.FIELDSET, next(adminform)) fieldsets_and_inlines.append(
) (FieldsetInlineOrder.FIELDSET, next(adminform))
elif choice == FieldsetInlineOrder.INLINE: )
fieldsets_and_inlines.append((FieldsetInlineOrder.INLINE, next(inlines))) elif choice == FieldsetInlineOrder.INLINE:
fieldsets_and_inlines.append((FieldsetInlineOrder.INLINE, next(inlines)))
except StopIteration:
# Missing permissions, ignore and move on
continue
for fieldset in adminform: for fieldset in adminform:
fieldsets_and_inlines.append((FieldsetInlineOrder.FIELDSET, fieldset)) fieldsets_and_inlines.append((FieldsetInlineOrder.FIELDSET, fieldset))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment