diff --git a/loko/documents/forms.py b/loko/documents/forms.py index bcd11ac..cbc2688 100644 --- a/loko/documents/forms.py +++ b/loko/documents/forms.py @@ -31,6 +31,21 @@ class TagField(forms.CharField): return [item.strip() for item in value.split(",") if item.strip()] +class DocumentUpdateForm(forms.ModelForm): + class Meta: + model = ManagedDocument + fields = ["title", "description"] + widgets = { + "title": forms.TextInput(attrs={"class": "form-control"}), + "description": forms.Textarea(attrs={"class": "form-control", "rows": 4}), + } + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.fields["title"].widget.attrs.setdefault("class", "form-control") + self.fields["description"].widget.attrs.setdefault("class", "form-control") + + class ManagedDocumentForm(forms.ModelForm): file = forms.FileField(label=_("File")) comment = forms.CharField(label=_("Comment"), required=False, widget=forms.Textarea(attrs={"rows": 2})) diff --git a/loko/documents/templates/documents/document_detail.html b/loko/documents/templates/documents/document_detail.html index cce1bd0..a741023 100644 --- a/loko/documents/templates/documents/document_detail.html +++ b/loko/documents/templates/documents/document_detail.html @@ -19,10 +19,22 @@
{{ document.description|default:_("No description provided") }}