diff --git a/bookwyrm/forms/books.py b/bookwyrm/forms/books.py index 91d9b8f00..72df1371c 100644 --- a/bookwyrm/forms/books.py +++ b/bookwyrm/forms/books.py @@ -14,6 +14,14 @@ class CoverForm(CustomForm): help_texts = {f: None for f in fields} +class ArrayWidget(forms.widgets.TextInput): + # pylint: disable=unused-argument + # pylint: disable=no-self-use + def value_from_datadict(self, data, files, name): + """get all values for this name""" + return [i for i in data.getlist(name) if i] + + class EditionForm(CustomForm): class Meta: model = models.Edition @@ -41,12 +49,10 @@ class EditionForm(CustomForm): "series_number": forms.TextInput( attrs={"aria-describedby": "desc_series_number"} ), + "subjects": ArrayWidget(), "languages": forms.TextInput( attrs={"aria-describedby": "desc_languages_help desc_languages"} ), - "subjects": forms.TextInput( - attrs={"aria-describedby": "desc_subjects"} - ), "publishers": forms.TextInput( attrs={"aria-describedby": "desc_publishers_help desc_publishers"} ),