Skip to content

Commit effa5bd

Browse files
ajrbyersjoemull
authored andcommitted
Use fields rather than exclude for ChapterForm
1 parent e852baf commit effa5bd

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

forms.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,19 @@ def __init__(self, *args, **kwargs):
101101

102102
class Meta:
103103
model = models.Chapter
104-
exclude = ('book', 'filename', 'keywords', 'publisher_notes')
104+
fields = [
105+
'title',
106+
'description',
107+
'pages',
108+
'doi',
109+
'number',
110+
'date_embargo',
111+
'date_published',
112+
'sequence',
113+
'contributors',
114+
'license_information',
115+
'custom_how_to_cite',
116+
]
105117

106118
def save(self, commit=True, book=None, *args, **kwargs):
107119
save_chapter = super(ChapterForm, self).save(commit=False)

models.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,9 @@ class Chapter(models.Model):
448448
custom_how_to_cite = models.TextField(
449449
blank=True, null=True,
450450
help_text="Custom 'how to cite' text. To be used only if the block"
451-
" generated by Janeway is not suitable.",
451+
" generated by Janeway is not suitable.",
452452
)
453453

454-
455454
class Meta:
456455
ordering = ('sequence', 'number',)
457456

0 commit comments

Comments
 (0)