aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'pyblackbird_cc/resources/forms.py')
-rw-r--r--pyblackbird_cc/resources/forms.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py
index dbc6df5..efe1ccb 100644
--- a/pyblackbird_cc/resources/forms.py
+++ b/pyblackbird_cc/resources/forms.py
@@ -6,7 +6,7 @@ from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from django import forms
-from pyblackbird_cc.resources.models import Resource
+from pyblackbird_cc.resources.models import Resource, ResourceSubcategory
from pyblackbird_cc.resources.models import ResourceCategory
from pyblackbird_cc.resources.models import ResourceType
from .models import AGE_RANGE_CHOICES
@@ -19,7 +19,7 @@ ALLOWED_PDFS = 20
def _create_choices_tuple() -> List[Tuple[str, str]]:
- qs_lst = list(ResourceCategory.objects.values_list('name', flat=True))
+ qs_lst = list(ResourceSubcategory.objects.values_list('name', flat=True))
res = []
for x in qs_lst:
res.append((x, x))
@@ -31,6 +31,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()
error_css_class = "error"
required_css_class = "required"
@@ -84,9 +85,9 @@ class ResourceCreateForm(forms.Form):
"to one or two to make your resource easier to find.",
)
additional_resource_category = forms.MultipleChoiceField(
- choices=_create_choices_tuple(),
required=False,
)
+
pdf_files = forms.FileField(
widget=forms.TextInput(
attrs={
@@ -159,6 +160,7 @@ class ResourceUpdateMetadataForm(forms.ModelForm):
super().__init__(*args, **kwargs)
self.helper = FormHelper(self)
self.helper.add_input(Submit("submit", "Submit"))
+ self.fields['additional_resource_category'].choices = _create_choices_tuple()
error_css_class = "error"
required_css_class = "required"