diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-13 11:58:50 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2016-12-13 11:58:50 +0100 |
commit | 93ec6cf50bec2ecb4035850feb0003fec2d2138c (patch) | |
tree | 2c3507d130b20c859c27567a44563a84ef74eca4 /archaeological_finds/forms_treatments.py | |
parent | ddd5ad887467e6e8592471f19997c85aafe08773 (diff) | |
download | Ishtar-93ec6cf50bec2ecb4035850feb0003fec2d2138c.tar.bz2 Ishtar-93ec6cf50bec2ecb4035850feb0003fec2d2138c.zip |
Treatment file: add applicant and applicant organisation
Diffstat (limited to 'archaeological_finds/forms_treatments.py')
-rw-r--r-- | archaeological_finds/forms_treatments.py | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index cb075102b..44045308f 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -325,6 +325,24 @@ class TreatmentFileSelect(TableSelect): year = forms.IntegerField(label=_(u"Year")) index = forms.IntegerField(label=_(u"Index")) type = forms.ChoiceField(label=_(u"Treatment file type"), choices=[]) + in_charge = forms.IntegerField( + label=_(u"In charge"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person'), + associated_model=Person), + validators=[valid_id(Person)]) + applicant = forms.IntegerField( + label=_(u"Applicant"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person'), + associated_model=Person), + validators=[valid_id(Person)]) + applicant_organisation = forms.IntegerField( + label=_(u"Applicant organisation"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-organization'), + associated_model=Organization), + validators=[valid_id(Organization)]) def __init__(self, *args, **kwargs): super(TreatmentFileSelect, self).__init__(*args, **kwargs) @@ -347,18 +365,21 @@ class TreatmentFileFormSelection(forms.Form): class TreatmentFileForm(ManageOldType, forms.Form): form_label = _(u"Treatment file") base_models = ['treatment_type_type'] - associated_models = {'type': models.TreatmentFileType, - 'in_charge': Person} + associated_models = { + 'type': models.TreatmentFileType, 'in_charge': Person, + 'applicant': Person, 'applicant_organisation': Organization} need_user_for_initialization = True name = forms.CharField(label=_(u"Name"), max_length=1000, required=False) - internal_reference = forms.CharField( - label=_(u"Internal ref."), max_length=60, required=False) year = forms.IntegerField(label=_("Year"), initial=lambda: datetime.datetime.now().year, validators=[validators.MinValueValidator(1900), validators.MaxValueValidator(2100)]) + internal_reference = forms.CharField( + label=_(u"Internal ref."), max_length=60, required=False) + external_id = forms.CharField( + label=_(u"External ref."), max_length=200, required=False) type = forms.ChoiceField( label=_(u"Treatment file type"), choices=[]) in_charge = forms.IntegerField( @@ -367,8 +388,18 @@ class TreatmentFileForm(ManageOldType, forms.Form): reverse_lazy('autocomplete-person'), associated_model=Person, new=True), validators=[valid_id(Person)]) - external_id = forms.CharField( - label=_(u"External ref."), max_length=200, required=False) + applicant = forms.IntegerField( + label=_(u"Applicant"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-person'), associated_model=Person, + new=True), + validators=[valid_id(Person)], required=False) + applicant_organisation = forms.IntegerField( + label=_(u"Applicant organisation"), + widget=widgets.JQueryAutoComplete( + reverse_lazy('autocomplete-organization'), + associated_model=Organization, new=True), + validators=[valid_id(Organization)], required=False) comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, required=False) creation_date = forms.DateField(label=_(u"Start date"), required=False, |