diff options
Diffstat (limited to 'archaeological_operations/forms.py')
-rw-r--r-- | archaeological_operations/forms.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index 4473d7858..a426eaf09 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -315,18 +315,22 @@ class OperationFormGeneral(forms.Form): widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person', args=["_".join( [unicode(HEAD_SCIENTIST.pk), unicode(SRA_AGENT.pk)])]), - associated_model=Person, new=True), + associated_model=Person, + limit={'person_types':(HEAD_SCIENTIST.pk, SRA_AGENT.pk)}, + new=True), validators=[valid_id(Person)], required=False) operator = forms.IntegerField(label=_("Operator"), widget=widgets.JQueryAutoComplete(reverse_lazy( 'autocomplete-organization', args=[OPERATOR.pk]), + limit={'organization_type':(OPERATOR.pk,)}, associated_model=Organization, new=True), validators=[valid_id(Organization)], required=False) in_charge = forms.IntegerField(label=_("In charge"), widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person', - args=["_".join( - [unicode(PersonType.objects.get(txt_idx='sra_agent').pk)])]), - associated_model=Person, new=True), + args=["_".join([unicode(SRA_AGENT.pk)])]), + associated_model=Person, + limit={'person_types':[SRA_AGENT.pk]}, + new=True), validators=[valid_id(Person)], required=False) operation_type = forms.ChoiceField(label=_(u"Operation type"), choices=[]) @@ -368,9 +372,8 @@ class OperationFormGeneral(forms.Form): widget=widgets.JQueryDate) cira_rapporteur = forms.IntegerField(label=u"Rapporteur CIRA", widget=widgets.JQueryAutoComplete(reverse_lazy('autocomplete-person', - args=["_".join( - [unicode(PersonType.objects.get(txt_idx='head_scientist').pk), - unicode(PersonType.objects.get(txt_idx='sra_agent').pk)])]), + args=["_".join([unicode(HEAD_SCIENTIST.pk), unicode(SRA_AGENT.pk)])]), + limit={'person_types':[SRA_AGENT.pk, HEAD_SCIENTIST.pk]}, associated_model=Person, new=True), validators=[valid_id(Person)], required=False) comment = forms.CharField(label=_(u"Comment"), widget=forms.Textarea, |