diff options
Diffstat (limited to 'archaeological_finds/forms.py')
| -rw-r--r-- | archaeological_finds/forms.py | 31 | 
1 files changed, 14 insertions, 17 deletions
| diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index b291f4417..358b12477 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -132,7 +132,8 @@ class FindForm(CustomForm, ManageOldType):          'get_first_base_find__batch': models.BatchType,          'get_first_base_find__spatial_reference_system': SpatialReferenceSystem,          'material_type_quality': models.MaterialTypeQualityType, -        'object_type_quality': models.ObjectTypeQualityType +        'object_type_quality': models.ObjectTypeQualityType, +        'checked_type': models.CheckedType,      }      HEADERS = {}      HEADERS['label'] = FormHeader(_(u"Identification")) @@ -225,8 +226,8 @@ class FindForm(CustomForm, ManageOldType):      get_first_base_find__estimated_error_z = \          forms.FloatField(label=_(u"Estimated error for Z"), required=False) -    HEADERS['checked'] = FormHeader(_(u"Sheet")) -    checked = forms.ChoiceField(label=_(u"Check")) +    HEADERS['checked_type'] = FormHeader(_(u"Sheet")) +    checked_type = forms.ChoiceField(label=_(u"Check"), required=False)      check_date = forms.DateField(          initial=get_now, label=_(u"Check date"), widget=DatePicker) @@ -240,6 +241,7 @@ class FindForm(CustomForm, ManageOldType):          FieldType('get_first_base_find__batch', models.BatchType),          FieldType('get_first_base_find__spatial_reference_system',                    SpatialReferenceSystem), +        FieldType('checked_type', models.CheckedType, is_multiple=True),      ]      PROFILE_FILTER = {          'mapping': [ @@ -257,7 +259,6 @@ class FindForm(CustomForm, ManageOldType):          if not context_record or \                  not context_record.operation.operation_type.judiciary:              self.fields.pop('seal_number') -        self.fields['checked'].choices = models.CHECK_CHOICES      def clean(self):          taq = self.cleaned_data.get('get_first_base_find__discovery_date_taq', @@ -452,12 +453,10 @@ class FindSelect(CustomForm, TableSelect):              reverse_lazy('autocomplete-contextrecord'),              associated_model=ContextRecord),          validators=[valid_id(ContextRecord)]) -    ope_relation_types = forms.MultipleChoiceField( -        label=_(u"Search within related operations"), choices=[], -        widget=widgets.CheckboxSelectMultiple) -    cr_relation_types = forms.MultipleChoiceField( -        label=_(u"Search within related context records"), choices=[], -        widget=widgets.CheckboxSelectMultiple) +    ope_relation_types = forms.ChoiceField( +        label=_(u"Search within related operations"), choices=[]) +    cr_relation_types = forms.ChoiceField( +        label=_(u"Search within related context records"), choices=[])      datings__period = forms.ChoiceField(label=_(u"Period"), choices=[])      material_types = forms.ChoiceField(label=_(u"Material type"), choices=[])      object_types = forms.ChoiceField(label=_(u"Object type"), choices=[]) @@ -472,7 +471,7 @@ class FindSelect(CustomForm, TableSelect):      base_finds__find__description = forms.CharField(label=_(u"Description"))      base_finds__batch = forms.ChoiceField(          label=_(u"Batch/object"), choices=[]) -    checked = forms.ChoiceField(label=_("Check")) +    checked_type = forms.ChoiceField(label=_("Check"))      documents__image__isnull = forms.NullBooleanField(label=_(u"Has an image?"))      TYPES = [ @@ -487,19 +486,17 @@ class FindSelect(CustomForm, TableSelect):          FieldType('base_finds__context_record__town__areas', Area),          FieldType('base_finds__context_record__operation__operation_type',                    OperationType), +        FieldType('checked_type', models.CheckedType),      ]      def __init__(self, *args, **kwargs):          super(FindSelect, self).__init__(*args, **kwargs) -        if 'checked' in self.fields: -            self.fields['checked'].choices = \ -                [('', '--')] + list(models.CHECK_CHOICES)          if 'ope_relation_types' in self.fields:              self.fields['ope_relation_types'].choices = \ -                OpeRelationType.get_types(empty_first=False) +                OpeRelationType.get_types()          if 'cr_relation_types' in self.fields:              self.fields['cr_relation_types'].choices = CRRelationType.get_types( -                empty_first=False) +                )      def get_input_ids(self):          ids = super(FindSelect, self).get_input_ids() @@ -528,7 +525,7 @@ class FindSelectWarehouseModule(FindSelect):              associated_model=Warehouse),          validators=[valid_id(Warehouse)])      container__index = forms.IntegerField(label=_(u"Container ID")) -    container__reference = forms.IntegerField(label=_(u"Container ref.")) +    container__reference = forms.CharField(label=_(u"Container ref."))  class FindFormSelection(CustomFormSearch): | 
