diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-28 18:34:45 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2018-02-28 18:34:45 +0100 |
commit | cf316bfcd2299c1d930a8f9af9c44f8cd6a0bc58 (patch) | |
tree | 6f9f67897d36106520b51e5045e9e11852f44ba0 | |
parent | 969ac961c199a889d860ffb14cc165b22ffcf701 (diff) | |
download | Ishtar-cf316bfcd2299c1d930a8f9af9c44f8cd6a0bc58.tar.bz2 Ishtar-cf316bfcd2299c1d930a8f9af9c44f8cd6a0bc58.zip |
Reorganize find wizard
-rw-r--r-- | archaeological_finds/forms.py | 99 | ||||
-rw-r--r-- | archaeological_finds/models_finds.py | 6 | ||||
-rw-r--r-- | ishtar_common/apps.py | 2 | ||||
-rw-r--r-- | ishtar_common/static/media/styles.css | 10 | ||||
-rw-r--r-- | ishtar_common/templates/blocks/bs_form_snippet.html | 6 | ||||
-rw-r--r-- | scss/custom.scss | 13 | ||||
-rw-r--r-- | version.py | 4 |
7 files changed, 83 insertions, 57 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py index 8ecd10ff5..91a661adc 100644 --- a/archaeological_finds/forms.py +++ b/archaeological_finds/forms.py @@ -133,20 +133,26 @@ class FindForm(CustomForm, ManageOldType): form_label = _("Find") form_admin_name = _(u"Find - 020 - General") form_slug = "find-020-general" - base_models = ['get_first_base_find', 'object_type', 'material_type', - 'integritie', 'remarkabilitie'] + base_models = ['get_first_base_find', 'object_type', 'material_type'] associated_models = {'material_type': models.MaterialType, 'object_type': models.ObjectType, - 'integritie': models.IntegrityType, 'get_first_base_find__batch': models.BatchType, - 'remarkabilitie': models.RemarkabilityType, 'get_first_base_find__spatial_reference_system': SpatialReferenceSystem} + HEADERS = {} + + HEADERS['label'] = FormHeader(_(u"Identification")) label = forms.CharField( label=_(u"Free ID"), validators=[validators.MaxLengthValidator(60)]) previous_id = forms.CharField(label=_("Previous ID"), required=False) - description = forms.CharField(label=_("Description"), + get_first_base_find__excavation_id = forms.CharField( + label=_(u"Excavation ID"), required=False) + museum_id = forms.CharField(label=_(u"Museum ID"), required=False) + denomination = forms.CharField(label=_(u"Label"), required=False) + + HEADERS['description'] = FormHeader(_(u"Description")) + description = forms.CharField(label=_(u"Description"), widget=forms.Textarea, required=False) get_first_base_find__discovery_date = forms.DateField( label=_(u"Discovery date"), widget=DatePicker, required=False) @@ -156,17 +162,42 @@ class FindForm(CustomForm, ManageOldType): is_complete = forms.NullBooleanField(label=_(u"Is complete?"), required=False) material_type = widgets.Select2MultipleField( - label=_(u"Material type"), required=False + label=_(u"Material types"), required=False ) object_type = widgets.Select2MultipleField( label=_(u"Object types"), required=False, ) - integritie = forms.MultipleChoiceField( - label=_(u"Integrity / interest"), choices=[], - widget=widgets.Select2Multiple, required=False) - remarkabilitie = forms.MultipleChoiceField( - label=_(u"Remarkability"), choices=[], - widget=widgets.Select2Multiple, required=False) + find_number = forms.IntegerField(label=_(u"Find number"), required=False) + min_number_of_individuals = forms.IntegerField( + label=_(u"Minimum number of individuals (MNI)"), required=False) + + decoration = forms.CharField(label=_(u"Decoration"), widget=forms.Textarea, + required=False) + mark = forms.CharField(label=_(u"Mark"), widget=forms.Textarea, + required=False) + manufacturing_place = forms.CharField( + label=_(u"Manufacturing place"), required=False) + image = forms.ImageField( + label=_(u"Image"), help_text=mark_safe(get_image_help()), + max_length=255, required=False, widget=widgets.ImageFileInput()) + comment = forms.CharField(label=_(u"Comment"), required=False, + widget=forms.Textarea) + dating_comment = forms.CharField( + label=_(u"Comment on dating"), required=False, widget=forms.Textarea) + + HEADERS['length'] = FormHeader(_(u"Dimensions")) + length = FloatField(label=_(u"Length (cm)"), required=False) + width = FloatField(label=_(u"Width (cm)"), required=False) + height = FloatField(label=_(u"Height (cm)"), required=False) + diameter = FloatField(label=_(u"Diameter (cm)"), required=False) + thickness = FloatField(label=_(u"Thickness (cm)"), required=False) + volume = FloatField(label=_(u"Volume (l)"), required=False) + weight = FloatField(label=_(u"Weight (g)"), required=False) + dimensions_comment = forms.CharField( + label=_(u"Dimensions comment"), required=False, widget=forms.Textarea) + + HEADERS['get_first_base_find__topographic_localisation'] = FormHeader( + _(u"Coordinates")) get_first_base_find__topographic_localisation = forms.CharField( label=_(u"Point of topographic reference"), required=False, max_length=120 @@ -183,37 +214,16 @@ class FindForm(CustomForm, ManageOldType): forms.FloatField(label=_(u"Estimated error for Y"), required=False) get_first_base_find__estimated_error_z = \ forms.FloatField(label=_(u"Estimated error for Z"), required=False) - length = FloatField(label=_(u"Length (cm)"), required=False) - width = FloatField(label=_(u"Width (cm)"), required=False) - height = FloatField(label=_(u"Height (cm)"), required=False) - diameter = FloatField(label=_(u"Diameter (cm)"), required=False) - thickness = FloatField(label=_(u"Thickness (cm)"), required=False) - volume = FloatField(label=_(u"Volume (l)"), required=False) - weight = FloatField(label=_(u"Weight (g)"), required=False) - dimensions_comment = forms.CharField( - label=_(u"Dimensions comment"), required=False, widget=forms.Textarea) - find_number = forms.IntegerField(label=_(u"Find number"), required=False) - min_number_of_individuals = forms.IntegerField( - label=_(u"Minimum number of individuals (MNI)"), required=False) - mark = forms.CharField(label=_(u"Mark"), required=False) + + HEADERS['checked'] = FormHeader(_(u"Sheet")) checked = forms.ChoiceField(label=_(u"Check")) check_date = forms.DateField( initial=get_now, label=_(u"Check date"), widget=DatePicker) - comment = forms.CharField(label=_(u"Comment"), required=False, - widget=forms.Textarea) - dating_comment = forms.CharField( - label=_(u"Comment on dating"), required=False, widget=forms.Textarea) - estimated_value = FloatField(label=_(u"Estimated value"), required=False) - image = forms.ImageField( - label=_(u"Image"), help_text=mark_safe(get_image_help()), - max_length=255, required=False, widget=widgets.ImageFileInput()) TYPES = [ FieldType('material_type', models.MaterialType, is_multiple=True), FieldType('object_type', models.ObjectType, is_multiple=True), FieldType('get_first_base_find__batch', models.BatchType), - FieldType('integritie', models.IntegrityType, is_multiple=True), - FieldType('remarkabilitie', models.RemarkabilityType, is_multiple=True) ] def __init__(self, *args, **kwargs): @@ -234,9 +244,6 @@ class FindForm(CustomForm, ManageOldType): self.fields[srs].help_text = \ SpatialReferenceSystem.get_help() self.fields['checked'].choices = models.CHECK_CHOICES - self.fields['estimated_value'].label = u"{} ({})".format( - unicode(self.fields['estimated_value'].label), - get_current_profile().currency) def clean(self): if not get_current_profile().mapping: @@ -271,13 +278,21 @@ class PreservationForm(CustomForm, ManageOldType): form_admin_name = _(u"Find - 030 - Preservation") form_slug = "find-030-preservation" base_models = ['alteration', 'alteration_cause', - 'preservation_to_consider'] + 'preservation_to_consider', 'integritie', 'remarkabilitie'] associated_models = {'alteration': models.AlterationType, 'alteration_cause': models.AlterationCauseType, 'treatment_emergency': models.TreatmentEmergencyType, 'conservatory_state': models.ConservatoryState, 'preservation_to_consider': models.TreatmentType, + 'remarkabilitie': models.RemarkabilityType, + 'integritie': models.IntegrityType, } + integritie = forms.MultipleChoiceField( + label=_(u"Integrity / interest"), choices=[], + widget=widgets.Select2Multiple, required=False) + remarkabilitie = forms.MultipleChoiceField( + label=_(u"Remarkability"), choices=[], + widget=widgets.Select2Multiple, required=False) conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"), choices=[], required=False) alteration = forms.MultipleChoiceField( @@ -291,6 +306,7 @@ class PreservationForm(CustomForm, ManageOldType): widget=widgets.Select2Multiple, required=False) treatment_emergency = forms.ChoiceField(label=_("Treatment emergency"), choices=[], required=False) + estimated_value = FloatField(label=_(u"Estimated value"), required=False) insurance_value = FloatField(label=_(u"Insurance value"), required=False) appraisal_date = forms.DateField( label=_(u"Appraisal date"), widget=DatePicker, required=False) @@ -304,6 +320,8 @@ class PreservationForm(CustomForm, ManageOldType): FieldType('preservation_to_consider', models.TreatmentType, True), FieldType('alteration', models.AlterationType, True), FieldType('alteration_cause', models.AlterationCauseType, True), + FieldType('integritie', models.IntegrityType, is_multiple=True), + FieldType('remarkabilitie', models.RemarkabilityType, is_multiple=True) ] def __init__(self, *args, **kwargs): @@ -311,6 +329,9 @@ class PreservationForm(CustomForm, ManageOldType): self.fields['insurance_value'].label = u"{} ({})".format( unicode(self.fields['insurance_value'].label), get_current_profile().currency) + self.fields['estimated_value'].label = u"{} ({})".format( + unicode(self.fields['estimated_value'].label), + get_current_profile().currency) class DateForm(ManageOldType, forms.Form): diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py index 047c08ffc..bbd9ff7e6 100644 --- a/archaeological_finds/models_finds.py +++ b/archaeological_finds/models_finds.py @@ -255,7 +255,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, OwnPerms): CACHED_LABELS = ['cache_short_id', 'cache_complete_id'] PARENT_SEARCH_VECTORS = ['context_record'] BASE_SEARCH_VECTORS = ["label", "description", "comment", "cache_short_id", - "cache_complete_id"] + "cache_complete_id", "excavation_id"] class Meta: verbose_name = _(u"Base find") @@ -784,7 +784,9 @@ class Find(BulkUpdatedItem, ValueGetter, BaseHistorizedItem, ImageModel, BASE_SEARCH_VECTORS = [ "cached_label", "label", "description", "container__location__name", "container__reference", "mark", "comment", "dating_comment", - "previous_id"] + "previous_id", "denomination", "museum_id", "decoration", + "manufacturing_place" + ] M2M_SEARCH_VECTORS = [ "datings__period__label", "object_types__label", "integrities__label", "remarkabilities__label", "material_types__label"] diff --git a/ishtar_common/apps.py b/ishtar_common/apps.py index 24a2aa881..56768bc51 100644 --- a/ishtar_common/apps.py +++ b/ishtar_common/apps.py @@ -6,10 +6,12 @@ from django.utils.translation import ugettext_lazy as _ import virtualtime + class IshtarAdminSite(AdminSite): site_header = _('Ishtar administration') site_title = _("Ishtar administration") + admin_site = IshtarAdminSite(name='ishtaradmin') diff --git a/ishtar_common/static/media/styles.css b/ishtar_common/static/media/styles.css index 7055502c7..37170a801 100644 --- a/ishtar_common/static/media/styles.css +++ b/ishtar_common/static/media/styles.css @@ -139,16 +139,6 @@ div#foot{ font-size: 0.9em; } -.clean-table h4, -.sheet h4, .sheet h3{ - text-align: center; - text-shadow: 2px 2px 2px rgba(150, 150, 150, 0.70); -} - -.clean-table h4{ - margin-top: 1em; -} - .mini-table{ height: 500px; overflow: auto; diff --git a/ishtar_common/templates/blocks/bs_form_snippet.html b/ishtar_common/templates/blocks/bs_form_snippet.html index cc17b45eb..7c7d4175a 100644 --- a/ishtar_common/templates/blocks/bs_form_snippet.html +++ b/ishtar_common/templates/blocks/bs_form_snippet.html @@ -71,10 +71,7 @@ </div>{% endif %} <h3>{{field.name|from_dict:form.HEADERS|call:'render'}}</h3> <div class="form-row"> - -{% elif not search and forloop.counter0|divisibleby:2 or search and forloop.counter1|divisibleby:2 %} -{% if forloop.counter0 %} - </div>{% endif %} +{% elif not search and not forloop.counter0 or search and forloop.counter0 == 1 %} <div class="form-row"> {% endif %} {% include "blocks/bs_field_snippet.html" %} @@ -89,6 +86,7 @@ </div> </div> </div> + </div> {% endif %} </div> {% endif %} diff --git a/scss/custom.scss b/scss/custom.scss index 469fa853a..2eb22e081 100644 --- a/scss/custom.scss +++ b/scss/custom.scss @@ -157,10 +157,23 @@ textarea { padding-left: 0.1em; } +.form h4, .form h3, #window h3{ background-color: $gray-400; } +.clean-table h4, +.form h4, .form h3, +.sheet h4, .sheet h3{ + text-align: center; + text-shadow: 2px 2px 2px rgba(150, 150, 150, 0.70); +} + +.clean-table h4{ + margin-top: 1em; +} + + .container{ margin-top: 1em; margin-bottom: 8em; diff --git a/version.py b/version.py index 4285fe459..a8bb0af4e 100644 --- a/version.py +++ b/version.py @@ -1,5 +1,5 @@ -# 1.99.17 -VERSION = (1, 99, 17) +# 1.99.18 +VERSION = (1, 99, 18) def get_version(): |