diff options
| -rw-r--r-- | archaeological_finds/forms_treatments.py | 4 | ||||
| -rw-r--r-- | archaeological_finds/models_treatments.py | 9 | ||||
| -rw-r--r-- | archaeological_finds/templates/ishtar/sheet_treatmentfile.html | 74 | 
3 files changed, 56 insertions, 31 deletions
| diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py index 56eb76802..fd74cc599 100644 --- a/archaeological_finds/forms_treatments.py +++ b/archaeological_finds/forms_treatments.py @@ -285,8 +285,8 @@ class TreatmentDeletionForm(FinalForm):          u"lost!")      confirm_end_msg = _(u"Would you like to delete this treatment?") -SLICING = (("month", _(u"months")), ('year', _(u"years")),) +SLICING = (("month", _(u"months")), ('year', _(u"years")),)  DATE_SOURCE = (("start", _(u"Start date")), ("end", _(u"Closing date")),) @@ -402,6 +402,7 @@ class AdministrativeActTreatmentModifForm(  class TreatmentFileSelect(TableSelect): +    search_vector = forms.CharField(label=_(u"Full text search"))      name = forms.CharField(label=_(u"Name"))      internal_reference = forms.CharField(label=_(u"Internal ref."))      year = forms.IntegerField(label=_(u"Year")) @@ -433,6 +434,7 @@ class TreatmentFileSelect(TableSelect):  class TreatmentFileFormSelection(forms.Form): +    SEARCH_AND_SELECT = True      form_label = _("Treatment request search")      associated_models = {'pk': models.TreatmentFile}      currents = {'pk': models.TreatmentFile} diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py index a09df554e..b35912fd0 100644 --- a/archaeological_finds/models_treatments.py +++ b/archaeological_finds/models_treatments.py @@ -286,6 +286,7 @@ class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,          return "-".join([str(slugify(getattr(self, attr)))                           for attr in ('year', 'index', 'label')]) +  post_save.connect(cached_label_changed, sender=Treatment) @@ -302,6 +303,7 @@ def pre_delete_treatment(sender, **kwargs):          find.downstream_treatment = None          find.save() +  pre_delete.connect(pre_delete_treatment, sender=Treatment) @@ -479,6 +481,8 @@ class TreatmentFileType(GeneralType):          verbose_name = _(u"Treatment request type")          verbose_name_plural = _(u"Treatment request types")          ordering = ('label',) + +  post_save.connect(post_save_cache, sender=TreatmentFileType)  post_delete.connect(post_save_cache, sender=TreatmentFileType) @@ -488,6 +492,11 @@ class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem,      SLUG = 'treatmentfile'      SHOW_URL = 'show-treatmentfile'      TABLE_COLS = ['type', 'year', 'index', 'internal_reference', 'name'] +    BASE_SEARCH_VECTORS = [ +        'type__label', 'internal_reference', 'name', 'comment' +    ] +    INT_SEARCH_VECTORS = ['year', 'index'] +    PARENT_SEARCH_VECTORS = ['in_charge', 'applicant', 'applicant_organisation']      SLUG = 'treatmentfile'      # fields diff --git a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html index 9567d3081..f474aab7c 100644 --- a/archaeological_finds/templates/ishtar/sheet_treatmentfile.html +++ b/archaeological_finds/templates/ishtar/sheet_treatmentfile.html @@ -1,46 +1,60 @@  {% extends "ishtar/sheet.html" %}  {% load i18n window_field from_dict link_to_window window_tables window_ope_tables window_header humanize %} -{% block head_title %}{% trans "Treatment request" %}{% endblock %} -{% block content %} +{% block head_title %}<strong>{% trans "Treatment request" %}</strong> - {{ item.name|default:"" }}{% endblock %} + +{% block toolbar %}  {% window_nav item window_id 'show-treatmentfile' 'treatmentfile_modify' 'show-historized-treatmentfile' 'revert-treatmentfile' previous next 1 %} +{% endblock %} -<p class="window-refs">{{ item.name|default:"" }}</p> -{% if item.internal_reference %} -<p class="window-refs">{{ item.internal_reference }}</p>{% endif %} -<p class="window-refs">{{ item.year }} - {{ item.index }}</p> -{% if item.external_id %} -<p class="window-refs">{{ item.external_id }}</p>{% endif %} -{% if item.end_date %} -<p class="window-refs">{% trans "Closed" context "Treatment request" %} ({{item.end_date}})</p> -{% else %} -<p class="window-refs">{% trans "Active" context "Treatment request" %}</p> -{% endif %} +{% block content %} -<ul class='form-flex'> -    {% field_li "Type" item.type %} -    {% field_li_detail "Responsible" item.in_charge %} -    {% field_li "Creation date" item.creation_date %} -    {% field_li "Reception date" item.reception_date %} -    {% field_li "Closing date" item.end_date %} -</ul> -{% field "Comment" item.comment "<pre>" "</pre>" %} +<div class="row"> +    <div class="offset-lg-4 col-lg-4 offset-md-3 col-md-6 offset-sm-1 col-sm-10 col-12"> +        <div class="card"> +            <div class="card-body"> +                <p class="card-text"> +                    <p class="window-refs">{{ item.name|default:"" }}</p> +                    {% if item.internal_reference %} +                    <p class="window-refs">{{ item.internal_reference }}</p>{% endif %} +                    <p class="window-refs">{{ item.year }} - {{ item.index }}</p> +                    {% if item.external_id %} +                    <p class="window-refs">{{ item.external_id }}</p>{% endif %} +                    {% if item.end_date %} +                    <p class="window-refs">{% trans "Closed" context "Treatment request" %} ({{item.end_date}})</p> +                    {% else %} +                    <p class="window-refs">{% trans "Active" context "Treatment request" %}</p> +                    {% endif %} +                </p> +            </div> +        </div> +    </div> +</div> -{% include "ishtar/blocks/sheet_json.html" %} +<div class="row"> +    {% field_flex "Type" item.type %} +    {% field_flex_detail "Responsible" item.in_charge %} +    {% field_flex "Creation date" item.creation_date %} +    {% field_flex "Reception date" item.reception_date %} +    {% field_flex "Closing date" item.end_date %} +    {% field_flex_full "Comment" item.comment "<pre>" "</pre>" %} +    {% include "ishtar/blocks/sheet_json.html" %} +</div>  {% if item.applicant %}  <h3>{% trans "Applicant" %}</h3> -<ul class='form-flex'> -    {% field_li_detail "Name" item.applicant %} -</ul> -{% field "Contact" item.applicant.address_lbl %} +<div class="row"> +    {% field_flex_detail "Name" item.applicant %} +    {% field_flex_full "Contact" item.applicant.address_lbl %} +</div>  {% endif %} +  {% if item.applicant_organisation %}  <h3>{% trans "Applicant organisation" %}</h3> -<ul class='form-flex'> -    {% field_li_detail "Name" item.applicant_organisation %} -</ul> -{% field "Contact" item.applicant.address_lbl %} +<div class="row"> +    {% field_flex_detail "Name" item.applicant_organisation %} +    {% field_flex_full "Contact" item.applicant.address_lbl %} +</div>  {% endif %}  {% if item.treatments.count %} | 
