diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/models_common.py | 2 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/blocks/sheet_geographic.html | 6 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_organization.html | 4 | ||||
| -rw-r--r-- | ishtar_common/templates/ishtar/sheet_person.html | 4 | ||||
| -rw-r--r-- | ishtar_common/templatetags/window_field.py | 4 | ||||
| -rw-r--r-- | ishtar_common/views_item.py | 15 | 
6 files changed, 27 insertions, 8 deletions
diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index e2fa9988c..ed7cae234 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -881,7 +881,7 @@ class SheetFilter(BaseSheetFilter):          _("Exclude or include"),          default="E",          max_length=1, -        choices=(("E", _("exclude")), ("I", _("Include"))) +        choices=(("E", _("exclude")), ("I", _("include")))      )      class Meta: diff --git a/ishtar_common/templates/ishtar/blocks/sheet_geographic.html b/ishtar_common/templates/ishtar/blocks/sheet_geographic.html index ae9d2bdf5..d5f8a4d84 100644 --- a/ishtar_common/templates/ishtar/blocks/sheet_geographic.html +++ b/ishtar_common/templates/ishtar/blocks/sheet_geographic.html @@ -36,6 +36,10 @@          {% endautoescape %}          </td>{% endif %}      </tr> +{% empty %} +    <tr> +        <td colspan="10">{% trans "No geo items" %}</td> +    </tr>  {% endfor %}  </table>  {% if not IS_HISTORY and permission_change_geo and output != "ODT" and output != "PDF" %} @@ -43,4 +47,4 @@      <a class="btn btn-success" href="{% url 'create-pre-geo' item.app_label item.model_name item.pk %}{% if search_url %}?back_url={{search_url}}%3Fopen_item={{geo_item.pk|unlocalize}}{% endif %}"><i class="fa fa-plus"></i>  {% trans "geo item" %}</a>  </div>  {% endif %} -{% endwith %}
\ No newline at end of file +{% endwith %} diff --git a/ishtar_common/templates/ishtar/sheet_organization.html b/ishtar_common/templates/ishtar/sheet_organization.html index b6d18469d..ad629b21b 100644 --- a/ishtar_common/templates/ishtar/sheet_organization.html +++ b/ishtar_common/templates/ishtar/sheet_organization.html @@ -19,6 +19,7 @@    {% field_flex_detail_multiple "Biographical notes" item.biographical_notes %}  </div> +{% if item.members.count %}  <h3>{%trans "Person in the organization"%}</h3>  <table class='table table-striped'> @@ -39,6 +40,7 @@    <tr><td colspan="8" class='no_items'>{% trans "No person in this organization" %}</td></tr>    {% endfor %}  </table> +{% endif %}  {% trans "Associated operations as operator" as ao %}  {% if item.operator.count %} @@ -80,10 +82,12 @@  {% endif %}  {% if not is_external %} +{% if item.history_creator or item.last_edition_date or item.created %}  <h3>{% trans "Sheet"%}</h3>  <div class="row">    {% include "ishtar/blocks/sheet_creation_section.html" %}  </div>  {% endif %} +{% endif %}  {% endblock %} diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html index c34997d30..e0ec0d887 100644 --- a/ishtar_common/templates/ishtar/sheet_person.html +++ b/ishtar_common/templates/ishtar/sheet_person.html @@ -1,7 +1,7 @@  {% extends "ishtar/sheet.html" %}  {% load i18n window_field window_tables window_header %} -{% block head_title %}<strong>{% trans "Person"%}</strong> - {{item}}{% endblock %} +{% block head_title %}<strong>{% trans "Person"%}</strong> - {{item.raw_name}}{% endblock %}  {% block toolbar %}  {% window_nav item window_id 'show-person' 'person_modify' %} @@ -173,11 +173,13 @@  {% endif %}  {% if not is_external %} +{% if item.history_creator or item.last_edition_date or item.created %}  <h3>{% trans "Sheet"%}</h3>  <div class="row">      {% include "ishtar/blocks/sheet_creation_section.html" %}  </div>  {% endif %} +{% endif %}  {% endblock %} diff --git a/ishtar_common/templatetags/window_field.py b/ishtar_common/templatetags/window_field.py index 359330eb7..576a7d3cc 100644 --- a/ishtar_common/templatetags/window_field.py +++ b/ishtar_common/templatetags/window_field.py @@ -230,4 +230,6 @@ def m2m_listing(item, key):          if key in item:              return item[key]          return [] -    return item.m2m_listing(key) +    if callable(item.m2m_listing): +        return item.m2m_listing(key) +    return [] diff --git a/ishtar_common/views_item.py b/ishtar_common/views_item.py index 9570687bf..639af1e88 100644 --- a/ishtar_common/views_item.py +++ b/ishtar_common/views_item.py @@ -386,11 +386,13 @@ def filter_sheet(ishtar_user, item):      if exclude is None:          return item      base_keys = [ -        "id", "pk", "locked", "is_locked", "SLUG", "APP", "MODEL", -        "HAS_QR_CODE", "get_absolute_url", "get_extra_actions", -        "get_extra_templates", "can_edit", "can_delete", "DELETE_URL" +        "SLUG", "APP", "MODEL", "DELETE_URL" "HAS_QR_CODE", +        "id", "pk", "app_label", "model_name", "locked", "is_locked", +        "get_absolute_url", "get_extra_actions", "get_extra_templates", +        "can_edit", "can_delete"      ]      base_keys += getattr(item, "SHEET_BASE_KEYS", []) +    empty_keys = getattr(item, "SHEET_EMPTY_KEYS", [])      if exclude:          # cannot exclude base keys          len_keys = len(keys) @@ -401,9 +403,14 @@ def filter_sheet(ishtar_user, item):          keys += base_keys      if exclude:          for key in keys: -            setattr(item, key, None) +            try: +                setattr(item, key, None) +            except TypeError: +                pass          return item      new_item = type("BaseObject", (object,), {}) +    for empty_key in empty_keys: +        setattr(new_item, empty_key, None)      for key in keys:          setattr(new_item, key, getattr(item, key, None))      return new_item  | 
