Skip to content

Commit

Permalink
Admin: add super_badge to list display
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Dec 7, 2023
1 parent dbd49eb commit 0a84a15
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lemarche/siaes/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ class SiaeAdmin(FieldsetsInlineMixin, gis_admin.OSMGeoAdmin):
"siret",
"kind",
"city",
# "super_badge",
"super_badge",
"user_count_with_link",
"tender_email_send_count_annotated_with_link",
"tender_detail_display_count_annotated_with_link",
Expand Down
6 changes: 3 additions & 3 deletions lemarche/siaes/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,15 +1164,15 @@ def get_absolute_url(self):
return reverse("siae:detail", kwargs={"slug": self.slug})

def set_super_badge(self):
UPDATE_FIELDS = ["super_badge"]
update_fields_list = ["super_badge"]
siae_super_badge_current_value = self.super_badge
self.super_badge = self.super_badge_calculated

if self.super_badge != siae_super_badge_current_value:
self.super_badge_last_updated = timezone.now()
UPDATE_FIELDS.append("super_badge_last_updated")
update_fields_list.append("super_badge_last_updated")

self.save(update_fields=UPDATE_FIELDS)
self.save(update_fields=update_fields_list)


@receiver(post_save, sender=Siae)
Expand Down

0 comments on commit 0a84a15

Please sign in to comment.