diff options
Diffstat (limited to 'pyblackbird_cc/resources/forms.py')
-rw-r--r-- | pyblackbird_cc/resources/forms.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/pyblackbird_cc/resources/forms.py b/pyblackbird_cc/resources/forms.py index 5a4a606..f4c6654 100644 --- a/pyblackbird_cc/resources/forms.py +++ b/pyblackbird_cc/resources/forms.py @@ -2,8 +2,9 @@ import logging from typing import List, Tuple import magic +from crispy_forms.bootstrap import FormActions from crispy_forms.helper import FormHelper -from crispy_forms.layout import Submit +from crispy_forms.layout import Submit, Field, Layout, Button from django import forms from pyblackbird_cc.resources.models import Resource, ResourceSubcategory @@ -182,14 +183,20 @@ class ResourceUpdateMetadataForm(forms.ModelForm): class ResourceUpdatePDFsForm(forms.Form): - def __init__(self, *args, **kwargs): + def __init__(self, cancel_url: str, *args, **kwargs): try: self.resource = kwargs.pop("resource") except KeyError: pass super().__init__(*args, **kwargs) self.helper = FormHelper(self) - self.helper.add_input(Submit("submit", "Submit")) + self.helper.layout = Layout( + Field("pdf_files"), + FormActions( + Submit("submit", "Submit", css_class="btn btn-primary"), + Button("cancel", "Cancel", css_class="btn btn-danger", onclick=f"location.href=''"), + ), + ) pdf_files = forms.FileField( widget=forms.TextInput( |