aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-09-10 20:25:14 +0100
committerMatthew Lemon <y@yulqen.org>2024-09-10 20:25:14 +0100
commitd9b9e908c3e49d27bef347d72a5fce02302e1de9 (patch)
treec60b7950c2b8499a21f869b537f499b200ba86b8
parent93f46a7dc18c26d61539f6744de811567260f58b (diff)
Fix bug in subcategories choices func
-rw-r--r--pyblackbird_cc/resources/forms.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py
index 5327def..f046969 100644
--- a/pyblackbird_cc/resources/forms.py
+++ b/pyblackbird_cc/resources/forms.py
@@ -25,7 +25,9 @@ ALLOWED_PDFS = 20
def _create_choices_tuple() -> list[tuple[str, str]]:
"""Returns a list of tuples containing resource subcategory names."""
- return sorted(list(ResourceSubcategory.objects.values_list("name", flat=True)), key=str)
+ vals = sorted(ResourceSubcategory.objects.values_list("name", flat=True), key=str)
+ out = tuple((x, x) for x in vals)
+ return out
class ResourceCreateForm(forms.Form):
@@ -34,6 +36,7 @@ class ResourceCreateForm(forms.Form):
self.helper = FormHelper(self)
self.helper.add_input(Submit("submit", "Submit"))
self.fields["subcategories"].choices = _create_choices_tuple()
+ pass
error_css_class = "error"
required_css_class = "required"