Skip to content

Commit

Permalink
Display number_of_emails in MalingListAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
juuso-j committed Apr 30, 2024
1 parent 128c63c commit 0c461e5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion account/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Meta:


class MailingListAdmin(DisableDeleteAdminMixin, DisableAddAdminMixin, admin.ModelAdmin):
list_display = ("result", "csv_emails")
list_display = ("result", "number_of_emails")

readonly_fields = ("result",)
form = MailingListAdminForm
Expand Down
3 changes: 3 additions & 0 deletions account/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ def __str__(self):
def csv_emails(self):
return ",".join([e.email for e in self.emails.all()])

def number_of_emails(self):
return self.emails.count()


class MailingListEmail(models.Model):
email = models.EmailField()
Expand Down

0 comments on commit 0c461e5

Please sign in to comment.