Skip to content

Commit

Permalink
Use fields rather than exclude for ChapterForm
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrbyers authored and joemull committed Aug 12, 2024
1 parent e852baf commit effa5bd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 13 additions & 1 deletion forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,19 @@ def __init__(self, *args, **kwargs):

class Meta:
model = models.Chapter
exclude = ('book', 'filename', 'keywords', 'publisher_notes')
fields = [
'title',
'description',
'pages',
'doi',
'number',
'date_embargo',
'date_published',
'sequence',
'contributors',
'license_information',
'custom_how_to_cite',
]

def save(self, commit=True, book=None, *args, **kwargs):
save_chapter = super(ChapterForm, self).save(commit=False)
Expand Down
3 changes: 1 addition & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,10 +448,9 @@ class Chapter(models.Model):
custom_how_to_cite = models.TextField(
blank=True, null=True,
help_text="Custom 'how to cite' text. To be used only if the block"
" generated by Janeway is not suitable.",
" generated by Janeway is not suitable.",
)


class Meta:
ordering = ('sequence', 'number',)

Expand Down

0 comments on commit effa5bd

Please sign in to comment.