diff options
author | Matthew Lemon <y@yulqen.org> | 2024-08-01 16:17:23 +0100 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2024-08-01 16:17:23 +0100 |
commit | bad2be31054ff5277b97230b5157edf6a8dd06cc (patch) | |
tree | dc9072a73d586fb00671f742a2e9054fec37f230 /pyblackbird_cc/resources/forms.py | |
parent | 5f37a5839ff00f4f85c5e63e4dcb8246204c9386 (diff) |
Fix bug where new subcategories were being created on selection
Diffstat (limited to '')
-rw-r--r-- | pyblackbird_cc/resources/forms.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py index e905944..be90a00 100644 --- a/pyblackbird_cc/resources/forms.py +++ b/pyblackbird_cc/resources/forms.py @@ -20,6 +20,7 @@ ALLOWED_PDFS = 20 def _create_choices_tuple() -> List[Tuple[str, str]]: qs_lst = list(ResourceSubcategory.objects.values_list('name', flat=True)) + qs_lst.sort() res = [] for x in qs_lst: res.append((x, x)) @@ -31,7 +32,7 @@ class ResourceCreateForm(forms.Form): super().__init__(*args, **kwargs) self.helper = FormHelper(self) self.helper.add_input(Submit("submit", "Submit")) - self.fields['additional_resource_category'].choices = _create_choices_tuple() + self.fields['subcategories'].choices = _create_choices_tuple() error_css_class = "error" required_css_class = "required" @@ -84,7 +85,7 @@ class ResourceCreateForm(forms.Form): "searches. It's a good idea to limit the number of subjects you select " "to one or two to make your resource easier to find.", ) - additional_resource_category = forms.MultipleChoiceField( + subcategories = forms.MultipleChoiceField( required=False, ) @@ -174,6 +175,6 @@ class ResourceUpdateMetadataForm(forms.ModelForm): "age_range", "curriculum", "main_resource_category", - "additional_resource_category", + "subcategories", "feature_slot", ] |