summaryrefslogtreecommitdiff
path: root/archaeological_files
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_files')
-rw-r--r--archaeological_files/forms.py12
1 files changed, 9 insertions, 3 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