diff --git a/scipost_django/funders/forms.py b/scipost_django/funders/forms.py index 7f15f130431a8a1e09859455f85b98ee6c8c546c..56a31f1d7ef0dd000953a8abcc0f652bbecb0988 100644 --- a/scipost_django/funders/forms.py +++ b/scipost_django/funders/forms.py @@ -30,7 +30,8 @@ class FunderSelectForm(forms.Form): queryset=Funder.objects.all(), widget=autocomplete.ModelSelect2( url='/funders/funder-autocomplete', - attrs={'data-html': True}) + attrs={'data-html': True} + ) ) class FunderOrganizationSelectForm(forms.ModelForm): @@ -54,6 +55,13 @@ class GrantForm(HttpRefererFormMixin, forms.ModelForm): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + self.fields['funder'] = forms.ModelChoiceField( + queryset=Funder.objects.all(), + widget=autocomplete.ModelSelect2( + url='/funders/funder-autocomplete', + attrs={'data-html': True} + ) + ) self.fields['recipient'] = forms.ModelChoiceField( queryset=Contributor.objects.select_related('user').order_by('user__last_name'), required=False) diff --git a/scipost_django/funders/templates/funders/funders_dashboard.html b/scipost_django/funders/templates/funders/funders_dashboard.html index 519c0fd5e1420ce734334d3d97a84e41342d6a1f..00f41be69942a6c490250814effc98dc1c0a647f 100644 --- a/scipost_django/funders/templates/funders/funders_dashboard.html +++ b/scipost_django/funders/templates/funders/funders_dashboard.html @@ -106,7 +106,7 @@ <h2>Add a grant</h2> <form action="{% url 'funders:add_grant' %}" method="post"> {% csrf_token %} - {{grant_form|bootstrap}} + {{ grant_form|bootstrap }} <input class="btn btn-outline-secondary" type="submit" value="Add"> </form> <br/> @@ -146,3 +146,8 @@ {% endblock content %} + +{% block footer_script %} + {{ block.super }} + {{ grant_form.media }} +{% endblock footer_script %} diff --git a/scipost_django/funders/templates/funders/grant_form.html b/scipost_django/funders/templates/funders/grant_form.html index dd5c57e977afa4dc2f5fc393089bfb3960485e22..63d2e4342745b08354fc28b8cc8b4b809a278094 100644 --- a/scipost_django/funders/templates/funders/grant_form.html +++ b/scipost_django/funders/templates/funders/grant_form.html @@ -23,3 +23,8 @@ </div> {% endblock content %} + +{% block footer_script %} + {{ block.super }} + {{ form.media }} +{% endblock footer_script %}