feat: suppression des coulées lors de la copie
This commit is contained in:
parent
06bcebdc83
commit
065ee38f58
@ -165,8 +165,12 @@ class FournéeAdmin(nested_admin.NestedModelAdmin):
|
|||||||
save_on_top = True
|
save_on_top = True
|
||||||
|
|
||||||
def save_related(self, request, form, formsets, change):
|
def save_related(self, request, form, formsets, change):
|
||||||
"""Création des coulées manquantes"""
|
|
||||||
super().save_related(request, form, formsets, change)
|
super().save_related(request, form, formsets, change)
|
||||||
|
"""Suppression des coulées en cas de copie"""
|
||||||
|
if "_saveasnew" in request.POST:
|
||||||
|
form.instance.coulée_set.all().delete()
|
||||||
|
|
||||||
|
"""Création des coulées manquantes si demandé"""
|
||||||
if change and "_continueandcreatecoulees" in request.POST:
|
if change and "_continueandcreatecoulees" in request.POST:
|
||||||
obj = form.instance
|
obj = form.instance
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user