SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 9828c994 authored by George Katsikas's avatar George Katsikas :goat:
Browse files

add autocomplete subsidy field to attachment form

parent 2638e3a1
No related branches found
No related tags found
No related merge requests found
...@@ -301,6 +301,19 @@ class SubsidyAttachmentForm(forms.ModelForm): ...@@ -301,6 +301,19 @@ class SubsidyAttachmentForm(forms.ModelForm):
"date": forms.DateInput(attrs={"type": "date"}), "date": forms.DateInput(attrs={"type": "date"}),
} }
subsidy = forms.ModelChoiceField(
queryset=Subsidy.objects.all(),
widget=autocomplete.ModelSelect2(
url=reverse_lazy("finances:subsidy_autocomplete"),
attrs={
"data-html": True,
"style": "width: 100%",
},
),
help_text=("Start typing, and select from the popup."),
required=False,
)
def clean_attachment(self): def clean_attachment(self):
attachment = self.cleaned_data["attachment"] attachment = self.cleaned_data["attachment"]
......
...@@ -83,3 +83,8 @@ ...@@ -83,3 +83,8 @@
</div> </div>
</div> </div>
{% endblock content %} {% endblock content %}
{% block footer_script %}
{{ block.super }}
{{ form.media }}
{% endblock footer_script %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment