diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-11-30 16:04:10 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2022-12-12 12:23:20 +0100 |
commit | 133e949dff015d39c8a5e1b28cd38b5c16853de7 (patch) | |
tree | bee2d5b383ae5e7784718a65c87007fe869c425e | |
parent | 8c5aeb8a6ff58d6b5b2ace1805bdf584a411d76d (diff) | |
download | Ishtar-133e949dff015d39c8a5e1b28cd38b5c16853de7.tar.bz2 Ishtar-133e949dff015d39c8a5e1b28cd38b5c16853de7.zip |
Minor template form improvement
-rw-r--r-- | archaeological_files/forms.py | 12 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/import_table.html | 2 |
2 files changed, 10 insertions, 4 deletions
diff --git a/archaeological_files/forms.py b/archaeological_files/forms.py index 9466d7d52..10e1d6722 100644 --- a/archaeological_files/forms.py +++ b/archaeological_files/forms.py @@ -66,6 +66,7 @@ from ishtar_common.forms import ( CustomFormSearch, DocumentItemSelect, FormHeader, + BSForm, ) from ishtar_common.forms_common import get_town_field from archaeological_operations.forms import ( @@ -893,13 +894,14 @@ JOB_LABELS = { } -class PreventiveFileForm(forms.ModelForm): +class PreventiveFileForm(BSForm, forms.ModelForm): file_id = forms.IntegerField(widget=forms.HiddenInput) def __init__(self, *args, **kwargs): self.file_id = kwargs.pop("file_id") super().__init__(*args, **kwargs) self.fields["file_id"].initial = self.file_id + self._post_init() def save(self, commit=True): if not self.errors: @@ -907,7 +909,7 @@ class PreventiveFileForm(forms.ModelForm): return super().save(commit=commit) -class PreventiveFileSimpleForm(forms.ModelForm): +class PreventiveFileSimpleForm(BSForm, forms.ModelForm): price_agreement = forms.ModelChoiceField( label=_("Price agreement"), queryset=models.PriceAgreement.objects.filter(available=True) @@ -917,10 +919,14 @@ class PreventiveFileSimpleForm(forms.ModelForm): model = models.File fields = ["price_agreement"] + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self._post_init() + class PreventiveFileGenJobForm(PreventiveFileForm): def __init__(self, *args, **kwargs): - super(PreventiveFileGenJobForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) current_value = None if hasattr(self.instance, "job") and self.instance.job: current_value = self.instance.job diff --git a/ishtar_common/templates/ishtar/import_table.html b/ishtar_common/templates/ishtar/import_table.html index 310e1c84d..b13f76dd9 100644 --- a/ishtar_common/templates/ishtar/import_table.html +++ b/ishtar_common/templates/ishtar/import_table.html @@ -65,7 +65,7 @@ $("#import-list").find('input').prop('disabled', true); {{import.status}} </td> <td> - <select name='import-action-{{import.pk}}'> + <select class="form-control" name='import-action-{{import.pk}}'> <option value=''>--------</option> {% for action, lbl in import.get_actions %} <option value='{{action}}'>{{lbl}}</option> |