Skip to content

Commit

Permalink
Update admin_forms.py
Browse files Browse the repository at this point in the history
Fix Message instance needs to have a primary key
  • Loading branch information
fearless-spider authored Jun 22, 2023
1 parent 9e0573b commit a5f5761
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions newsletter/admin_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

assert self.instance
next_sortorder = self.instance.get_next_article_sortorder()
for index, form in enumerate(self.extra_forms):
form.initial['sortorder'] = next_sortorder + index * 10
if self.instance.pk:
next_sortorder = self.instance.get_next_article_sortorder()
for index, form in enumerate(self.extra_forms):
form.initial['sortorder'] = next_sortorder + index * 10

0 comments on commit a5f5761

Please sign in to comment.