Skip to content

Commit

Permalink
[admin] fix siae form
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienReuiller committed Dec 19, 2023
1 parent 7408488 commit 248b03e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lemarche/siaes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class SiaeAdmin(FieldsetsInlineMixin, gis_admin.OSMGeoAdmin):
# OSMGeoAdmin param for coords fields
modifiable = False

fieldsets_with_inlines = [
fieldsets_with_inlines_original = [
(
"Affichage",
{
Expand Down Expand Up @@ -331,6 +331,9 @@ class SiaeAdmin(FieldsetsInlineMixin, gis_admin.OSMGeoAdmin):
("Dates", {"fields": ("created_at", "updated_at")}),
]

# _origin is used to switch between lighter fieldsets (add form) and full form (edit form)
fieldsets_with_inlines = fieldsets_with_inlines_original

add_fieldsets = [
# (
# "Affichage",
Expand Down Expand Up @@ -436,6 +439,8 @@ def get_fieldsets(self, request, obj=None):
"""
if not obj:
self.fieldsets_with_inlines = self.add_fieldsets
else:
self.fieldsets_with_inlines = self.fieldsets_with_inlines_original # returns the original fieldsets
return super().get_fieldsets(request, obj)

def get_changeform_initial_data(self, request):
Expand Down

0 comments on commit 248b03e

Please sign in to comment.