Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed tag selection widget to checkboxes in institution edit page.
- Loading branch information
dzejkob
committed
Oct 20, 2020
1 parent
bf4b557
commit a931b4f
Showing
5 changed files
with
31 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,28 @@ | ||
from atom.ext.crispy_forms.forms import SingleButtonMixin | ||
from braces.forms import UserKwargModelFormMixin | ||
from crispy_forms.helper import FormHelper | ||
from crispy_forms.layout import Layout, Fieldset, ButtonHolder, Submit | ||
from dal import autocomplete | ||
from django import forms | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
from .models import Institution | ||
|
||
|
||
class InstitutionForm(SingleButtonMixin, UserKwargModelFormMixin, forms.ModelForm): | ||
class InstitutionForm(UserKwargModelFormMixin, forms.ModelForm): | ||
def __init__(self, *args, **kwargs): | ||
super().__init__(*args, **kwargs) | ||
# Form "helper" is needed to have control over rendering by "crispy" tag. | ||
self.helper = FormHelper() | ||
self.helper.layout = Layout( | ||
Fieldset("", "name", "jst", "regon", "email"), | ||
Fieldset("", "tags", css_class="form-group scrollable-widget"), | ||
ButtonHolder(Submit("submit", _("Update"), css_class="btn btn-primary")), | ||
) | ||
|
||
class Meta: | ||
model = Institution | ||
fields = ["name", "tags", "jst", "regon", "email"] | ||
widgets = {"jst": autocomplete.ModelSelect2(url="teryt:community-autocomplete")} | ||
widgets = { | ||
"jst": autocomplete.ModelSelect2(url="teryt:community-autocomplete"), | ||
"tags": forms.CheckboxSelectMultiple, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.