summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@proxience.com>2015-09-29 02:43:19 +0200
committerÉtienne Loks <etienne.loks@proxience.com>2015-09-29 02:43:19 +0200
commitdf2405cb949e268dda4c880d2685054c0eab4a80 (patch)
treee27f01bf29b9fe16dfccc157f2a1f2d6fcb872e4 /archaeological_operations
parentfa03f91834500f7589ba1912a681227186d7974e (diff)
downloadIshtar-df2405cb949e268dda4c880d2685054c0eab4a80.tar.bz2
Ishtar-df2405cb949e268dda4c880d2685054c0eab4a80.zip
Display dynamicaly large tables in windows
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/models.py12
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html2
-rw-r--r--archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html2
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html90
4 files changed, 28 insertions, 78 deletions
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 977fbdb4a..90af1bd62 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -36,6 +36,7 @@ from ishtar_common.models import GeneralType, BaseHistorizedItem, \
DocumentTemplate, ShortMenuItem, DashboardFormItem, GeneralRelationType,\
GeneralRecordRelations, post_delete_record_relation
FILES_AVAILABLE = 'archaeological_files' in settings.INSTALLED_APPS
+FINDS_AVAILABLE = 'archaeological_finds' in settings.INSTALLED_APPS
class OperationType(GeneralType):
@@ -306,6 +307,17 @@ class Operation(BaseHistorizedItem, OwnPerms, ValueGetter, ShortMenuItem,
def show_url(self):
return reverse('show-operation', args=[self.pk, ''])
+ def has_finds(self):
+ if not FINDS_AVAILABLE:
+ return
+ from archaeological_finds.models import BaseFind
+ return BaseFind.objects.filter(context_record__operation=self).count()
+
+ def finds(self):
+ if FINDS_AVAILABLE:
+ from archaeological_finds.models import BaseFind
+ return BaseFind.objects.filter(context_record__operation=self)
+
def get_reference(self, full=False):
ref = ""
if self.code_patriarche:
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
index 9feb51e72..0be468b59 100644
--- a/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/administrativacts.html
@@ -1,5 +1,5 @@
{% load i18n %}
-<table>
+<table class='simple'>
<caption>{{caption}}</caption>
<tr>
<th>{% trans "Ref." %}</th>
diff --git a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
index 06a1fa7b1..e19b729fe 100644
--- a/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
+++ b/archaeological_operations/templates/ishtar/blocks/window_tables/parcels.html
@@ -1,5 +1,5 @@
{% load i18n %}
-<table>
+<table class='simple'>
<caption>{{ parcels_label }}</caption>
<tr>
<th>{% trans "Town" %}</th>
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index cc69abda0..daeea7c40 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -91,87 +91,25 @@
{% trans "Document from this operation" as operation_docs %}
{% if item.source.count %}
-{% table_document operation_docs item.source.all|slice:":15" %}
-{% if item.source.count > 15 %}
-<em>Seuls les 15 premiers éléments ont été affichés sur un total de {{item.source.count}}.</em>
-{% endif %}
+{% dynamic_table_document operation_docs 'operation_docs' 'operation' item.pk %}
{% endif %}
-<table>
- <caption>{%trans "Context records"%}</caption>
- <tr>
- <th>{% trans "ID" %}</th>
- <th>{% trans "Type" %}</th>
- <th>{% trans "Chronology" %}</th>
- <th>{% trans "Description" %}</th>
- <th>{% trans "Parcel" %}</th>
- <th class='link'>&nbsp;</th>
- </tr>
- {% for context_record in item.context_record.all|slice:"15" %}
- <tr>
- <td class='string'>{{ context_record.label }}</td>
- <td class='string'>{{context_record.unit|default:""}}</td>
- <td class='string'>{{ context_record.datings.all|join:", " }}</td>{# periods ?#}
- <td class='string'>{{ context_record.description }}</td>
- <td class='string'>{{ context_record.parcel.section }} - {{context_record.parcel.parcel_number}}</td>
- <td class='link'><a href="#" class='display_details' onclick='load_window("{%url show-contextrecord context_record.pk ''%}")'>{% trans "Details" %}</a></td>
- </tr>
- {% empty %}
- <tr><td colspan="6" class='no_items'>{% trans "No context record associated to this operation" %}</td></tr>
- {% endfor %}
-</table>
-{% if item.context_record.count > 15 %}
-<em>Seuls les 15 premiers éléments ont été affichés sur un total de {{item.context_record.count}}.</em>
+{% trans "Context records" as context_records %}
+{% if item.context_record.count %}
+{% dynamic_table_document context_records 'context_records' 'operation' item.pk %}
{% endif %}
+{% comment %}
{% trans "Documents from associated context records" as cr_docs %}
-{% if item.context_record_docs_q.count %} {% table_document cr_docs item.context_record_docs_q.all|slice:"15" %}{% endif %}
-
-<div class='table'>
-<table>
- <caption>{%trans "Finds"%}</caption>
- <tr>
- <th>{% trans "Complete Id" %}</th>
- <th>{% trans "Short Id" %}</th>
- <th>{% trans "Material type" %}</th>
- <th>{% trans "Context record" context "short"%}</th>
- <th>{% trans "Periods" %}</th>
- <th>{% trans "Description" %}</th>
- <th>{% trans "Weight" %}</th>
- <th>{% trans "Numbers" %}</th>
- <th>{% trans "Parcel" %}</th>
- <th>{% trans "Container ref." %}</th>
- <th>{% trans "Warehouse" %}</th>
- <th class='link'>&nbsp;</th>
- </tr>
- {% for context_record in item.context_record.all|slice:"5" %}
- {% for find in context_record.base_finds.all|slice:"15" %}
- <tr>
- {# OPE|MAT.CODE|UE|FIND_index #}
- <td class="ref">{{ find.complete_id|default:""}}</td>
- {# OPE|FIND_index #}
- <td class="ref">{{ find.short_id|default:"" }}</td>
- <td class="string">{{ find.get_last_find.material_type|default:"" }}</td>
- <td>{{find.context_record.label}}</td>
- <td class='string'>{{ find.get_last_find.dating}}</td>{# TODO .all|join:", " ? #}
- <td class='string'>{{ find.get_last_find.description }}</td>
- <td>{{ find.get_last_find.weight|default:"" }}</td>
- <td>{{ find.get_last_find.item_number }}</td>
- <td class="ref">{{ context_record.parcel.short_label }}</td>
- <td class='ref'>{{ find.get_last_find.container.reference|default:""}}</td>
- <td class='string'>{{ find.get_last_find.container.location|default:""}}</td>
- <td class='link'><a class='display_details' href="#">{% trans "Details" %}</a></td>
- {#<a href="#" class='display_details' onclick='load_window("{% url show-find find.pk%}");'>{%trans "Details"%}</a></td>#}
- </tr>
- {% empty %}
- <tr><td colspan="9" class='no_items'>{% trans "No find associated to context record" %} {{context_record.short_label}}</td></tr>
- {% endfor %}
- {% empty %}
- <tr><td colspan="9" class='no_items'>{% trans "No find associated to parcel" %} {{parcel.short_label}} {% trans "(no context record)" %}</td></tr>
- {% endfor %}
-</table>
-</div>
-<em>Seuls les 15 premiers éléments des 5 premières UEs sont affichées</em>
+{% if item.context_record_docs_q.count %}
+{% dynamic_table_document cr_docs 'context_records_docs' 'context_record__operation' item.pk %}
+{% endif %}
+{% endcomment %}
+
+{% trans "Finds" as finds %}
+{% if item.finds %}
+{% dynamic_table_document finds 'finds' 'base_finds__context_record__operation' item.pk %}
+{% endif %}
{% comment %}
{% trans "Documents from associated finds" as find_docs %}