aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/forms.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-05-24 20:43:43 +0100
committerMatthew Lemon <y@yulqen.org>2024-05-24 20:43:43 +0100
commitfda2c61fab80cbb8733dcbe32a061785c67b18a4 (patch)
tree4337a0ff6e0b4e538d92bb8b448720a5590ef91b /pyblackbird_cc/resources/forms.py
parent295b84a90f36b437356dc8c22b69dd230e44a823 (diff)
Tests validation of resource create form
In particular related to the new feature_slot field. Ensures that the feature_slot integer must be unique when attempts to save to the database and that the value given in the form is between 1 and 3.
Diffstat (limited to 'pyblackbird_cc/resources/forms.py')
-rw-r--r--pyblackbird_cc/resources/forms.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py
index 05d8a75..b8b638c 100644
--- a/pyblackbird_cc/resources/forms.py
+++ b/pyblackbird_cc/resources/forms.py
@@ -102,6 +102,7 @@ class ResourceCreateForm(forms.Form):
)
pdf_files.widget.attrs.update({"class": "file_upload", "accept": ".pdf"})
thumbnail_files.widget.attrs.update({"class": "file_upload", "accept": ".png,.jpg"})
+ feature_slot = forms.IntegerField(min_value=1, max_value=3, required=False)
def clean_thumbnail_files(self):
thumbnail_files = self.files.getlist("thumbnail_files")