diff options
author | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-04-04 14:58:05 +0200 |
---|---|---|
committer | Étienne Loks <etienne.loks@peacefrogs.net> | 2013-04-04 17:27:54 +0200 |
commit | 157259f4a9a030367f123ae1b2802c529b151197 (patch) | |
tree | 388ccdce5f40fe3bda8c457daeb397805925526d /archaeological_context_records/forms.py | |
parent | f7bf3b773787d336319518786f396cbf0342e567 (diff) | |
download | Ishtar-157259f4a9a030367f123ae1b2802c529b151197.tar.bz2 Ishtar-157259f4a9a030367f123ae1b2802c529b151197.zip |
Forms (operations, context records, files): add search by parcel (refs #575)
Diffstat (limited to 'archaeological_context_records/forms.py')
-rw-r--r-- | archaeological_context_records/forms.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/archaeological_context_records/forms.py b/archaeological_context_records/forms.py index 41e4a1e20..fce5193d6 100644 --- a/archaeological_context_records/forms.py +++ b/archaeological_context_records/forms.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2010-2012 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2010-2013 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -36,16 +36,17 @@ import models from ishtar_common import widgets from ishtar_common.forms import FinalForm, FinalForm, FormSet, \ - formset_factory, get_now, reverse_lazy, get_form_selection + formset_factory, get_now, reverse_lazy, get_form_selection, TableSelect from ishtar_common.forms_common import get_town_field, SourceForm, \ SourceSelect, AuthorFormset -from archaeological_operations.forms import OperationSelect +from archaeological_operations.forms import OperationSelect, ParcelField -class RecordSelect(forms.Form): +class RecordSelect(TableSelect): parcel__town = get_town_field() operation__year = forms.IntegerField(label=_(u"Year")) datings__period = forms.ChoiceField(label=_(u"Period"), choices=[]) unit = forms.ChoiceField(label=_(u"Unit type"), choices=[]) + parcel = ParcelField(label=_("Parcel (section/number)")) def __init__(self, *args, **kwargs): super(RecordSelect, self).__init__(*args, **kwargs) self.fields['datings__period'].choices = Period.get_types() @@ -53,6 +54,13 @@ class RecordSelect(forms.Form): self.fields['unit'].choices = models.Unit.get_types() self.fields['unit'].help_text = models.Unit.get_help() + def get_input_ids(self): + ids = super(RecordSelect, self).get_input_ids() + ids.pop(ids.index('parcel')) + ids.append('parcel_0') + ids.append('parcel_1') + return ids + class RecordFormSelection(forms.Form): form_label = _("Context record search") associated_models = {'pk':models.ContextRecord} |