Skip to content

Commit

Permalink
Fix issue introduced in admin
Browse files Browse the repository at this point in the history
Fixed an incorrect if statement in the admin.
Bumped to 0.13.0
  • Loading branch information
artscoop committed Feb 2, 2024
1 parent 55748fc commit 1855d28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "django-approval"
version = "0.12.0"
version = "0.13.0"
authors = [
{ name="Steve Kossouho", email="skossouho@dawan.fr" },
]
Expand Down
13 changes: 7 additions & 6 deletions src/approval/admin/monitored.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ def get_object(self, request, object_id, from_field: str = None) -> MonitoredMod
obj: MonitoredModel = super().get_object(request, object_id)
if isinstance(obj, MonitoredModel):
# Only display approval warning if the object has not been approved.
if hasattr(obj, "approval") and obj.approval and not obj.approval.approved:
if hasattr(obj, "approval") and obj.approval:
obj.approval._update_source(default=False, save=False)
obj.request = request
self.message_user(
request,
pgettext_lazy("approval", "This form is showing changes currently pending."),
level=messages.WARNING,
)
if obj.approval.approved != True:
self.message_user(
request,
pgettext_lazy("approval", "This form is showing changes currently pending."),
level=messages.WARNING,
)
else:
raise ImproperlyConfigured(f"No approval model was declared for this model.")
return obj
Expand Down

0 comments on commit 1855d28

Please sign in to comment.