Skip to content

Commit

Permalink
Merge pull request #5 from artscoop/approval-auto-deletion
Browse files Browse the repository at this point in the history
Display warning in admin only for pending
  • Loading branch information
artscoop authored Feb 1, 2024
2 parents 013b70b + 96dbb39 commit be2c9ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/approval/admin/monitored.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def get_object(self, request, object_id, from_field: str = None) -> MonitoredMod
"""Return the desired object, augmented with a request attribute."""
obj: MonitoredModel = super().get_object(request, object_id)
if isinstance(obj, MonitoredModel):
if hasattr(obj, "approval") and obj.approval:
# Only display approval warning if the object has not been approved.
if hasattr(obj, "approval") and obj.approval and not obj.approval.approved:
obj.approval._update_source(default=False, save=False)
obj.request = request
self.message_user(
Expand Down

0 comments on commit be2c9ae

Please sign in to comment.