Skip to content

Commit 2871f4e

Browse files
committed
Merge branch 'develop' – Set DREF to active for unpublished Final Reps
2 parents 5fba957 + a9fe7da commit 2871f4e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dref/admin.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,13 @@ def get_queryset(self, request):
228228
)
229229
)
230230

231+
# NOTE: If the Dref Final report is unpublished, set Dref related to it as active
232+
def save_model(self, request, obj, form, change):
233+
if not obj.is_published and obj.dref:
234+
obj.dref.is_active = True
235+
obj.dref.save(update_fields=["is_active"])
236+
super().save_model(request, obj, form, change)
237+
231238

232239
@admin.register(ProposedAction)
233240
class ProposedActionAdmin(ReadOnlyMixin, admin.ModelAdmin):

0 commit comments

Comments
 (0)