diff options
Diffstat (limited to 'pyblackbird_cc/resources/forms.py')
-rw-r--r-- | pyblackbird_cc/resources/forms.py | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py index f905811..da27fd4 100644 --- a/pyblackbird_cc/resources/forms.py +++ b/pyblackbird_cc/resources/forms.py @@ -5,8 +5,12 @@ from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from django import forms -from .models import ResourceCategory -from .models import ResourceType +from pyblackbird_cc.resources.models import Resource +from pyblackbird_cc.resources.models import ResourceCategory +from pyblackbird_cc.resources.models import ResourceType + +from .models import AGE_RANGE_CHOICES +from .models import CURRICULUM_CHOICES logger = logging.getLogger(__name__) @@ -50,24 +54,12 @@ class ResourceCreateForm(forms.Form): ) resource_type = forms.ModelChoiceField(queryset=ResourceType.objects.all()) age_range = forms.ChoiceField( - choices=[ - ("3-5", "3-5"), - ("5-7", "5-7"), - ("7-11", "7-11"), - ("11-14", "11-14"), - ("14-16", "14-16"), - ("16+", "16+"), - ("Age not applicable", "Age not applicable"), - ], + choices=AGE_RANGE_CHOICES, help_text="Try to be accurate in your choice of age range so that your resource " "shows up in the correct searches. (Although we don't have searches yet!)", ) curriculum = forms.ChoiceField( - choices=[ - ("No curriculum", "No curriculum"), - ("English", "English"), - ("Scottish", "Scottish"), - ], + choices=CURRICULUM_CHOICES, ) main_resource_category = forms.ModelChoiceField( queryset=ResourceCategory.objects.all(), @@ -137,3 +129,17 @@ class ResourceCreateForm(forms.Form): if len(pdf_files) > ALLOWED_PDFS: raise forms.ValidationError("Please select up to 20 PDF files.") return pdf_files + + +class ResourceUpdateMetadataForm(forms.ModelForm): + class Meta: + model = Resource + fields = [ + "name", + "description", + "resource_type", + "age_range", + "curriculum", + "main_resource_category", + "additional_resource_category", + ] |