fix condition for changing status to submitted
This commit is contained in:
@@ -386,9 +386,12 @@ class WirefAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
def save_model(self, request, obj, form, change):
|
||||||
# set status to submitted, if a file exists and status is opened.
|
# set status to submitted, if a file exists and status is opened.
|
||||||
get_status_open = obj.status == Wiref.Status.OPENED
|
if (
|
||||||
get_exist_file = obj.file_field != ""
|
change is True
|
||||||
if get_exist_file and get_status_open and "_generate_pdf" not in request.POST:
|
and obj.file_field != ""
|
||||||
|
and obj.status == Wiref.Status.OPENED
|
||||||
|
and "_generate_pdf" not in request.POST
|
||||||
|
):
|
||||||
obj.status = Wiref.Status.SUBMITTED
|
obj.status = Wiref.Status.SUBMITTED
|
||||||
super().save_model(request, obj, form, change)
|
super().save_model(request, obj, form, change)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user