summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--archaeological_context_records/models.py2
-rw-r--r--archaeological_context_records/views.py1
-rw-r--r--archaeological_finds/models.py3
-rw-r--r--archaeological_finds/views.py1
-rw-r--r--archaeological_operations/views.py1
-rw-r--r--ishtar_common/models.py15
-rw-r--r--ishtar_common/templates/ishtar/sheet_person.html35
7 files changed, 37 insertions, 21 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py
index 89e771eba..a5b1463bf 100644
--- a/archaeological_context_records/models.py
+++ b/archaeological_context_records/models.py
@@ -344,6 +344,8 @@ post_delete.connect(post_delete_record_relation, sender=RecordRelations)
class ContextRecordSource(Source):
SHOW_URL = 'show-contextrecordsource'
MODIFY_URL = 'record_source_modify'
+ TABLE_COLS = ['context_record__operation', 'context_record'] + \
+ Source.TABLE_COLS
class Meta:
verbose_name = _(u"Context record documentation")
diff --git a/archaeological_context_records/views.py b/archaeological_context_records/views.py
index c07dad1df..3e808c06b 100644
--- a/archaeological_context_records/views.py
+++ b/archaeological_context_records/views.py
@@ -99,6 +99,7 @@ get_contextrecordsource = get_item(
'title': 'title__icontains',
'description': 'description__icontains',
'comment': 'comment__icontains',
+ 'person': 'authors__person__pk',
'additional_information': 'additional_information__icontains',
'context_record__parcel__town': 'context_record__parcel__town__pk',
'context_record__operation__year': 'context_record__operation__year',
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index 4c46d5870..0bbe4f4cd 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -652,6 +652,9 @@ m2m_changed.connect(base_find_find_changed, sender=Find.base_finds.through)
class FindSource(Source):
SHOW_URL = 'show-findsource'
MODIFY_URL = 'find_source_modify'
+ TABLE_COLS = ['find__base_finds__context_record__operation',
+ 'find__base_finds__context_record', 'find'] + \
+ Source.TABLE_COLS
class Meta:
verbose_name = _(u"Find documentation")
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 2d03f6eba..cc070ba71 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -92,6 +92,7 @@ get_findsource = get_item(
'description': 'description__icontains',
'comment': 'comment__icontains',
'additional_information': 'additional_information__icontains',
+ 'person': 'authors__person__pk',
'find__base_finds__context_record__operation__year':
'find__base_finds__context_record__operation__year',
'find__base_finds__context_record__operation__operation_code':
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 8eb289c7d..607f06a81 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -182,6 +182,7 @@ get_operationsource = get_item(
'description': 'description__icontains',
'comment': 'comment__icontains',
'additional_information': 'additional_information__icontains',
+ 'person': 'authors__person__pk',
'operation__towns': 'operation__towns__pk',
'operation__operation_code': 'operation__operation_code',
'operation__code_patriarche': 'operation__code_patriarche',
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 97e578f01..6438a1f2c 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -2336,6 +2336,21 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
if getattr(self, attr)]
return slugify(u"-".join(values))
+ def operation_docs_q(self):
+ from archaeological_operations.models import OperationSource
+ return OperationSource.objects.filter(
+ authors__person=self)
+
+ def contextrecord_docs_q(self):
+ from archaeological_context_records.models import ContextRecordSource
+ return ContextRecordSource.objects.filter(
+ authors__person=self)
+
+ def find_docs_q(self):
+ from archaeological_finds.models import FindSource
+ return FindSource.objects.filter(
+ authors__person=self)
+
def save(self, *args, **kwargs):
super(Person, self).save(*args, **kwargs)
if hasattr(self, 'responsible_town_planning_service'):
diff --git a/ishtar_common/templates/ishtar/sheet_person.html b/ishtar_common/templates/ishtar/sheet_person.html
index 90b65b72c..3c554acdf 100644
--- a/ishtar_common/templates/ishtar/sheet_person.html
+++ b/ishtar_common/templates/ishtar/sheet_person.html
@@ -83,27 +83,20 @@
{% dynamic_table_document af 'files' 'in_charge' item.pk '' output %}
{% endif %}
-<table>
- <caption>{%trans "Documents"%}</caption>
- <tr>
- <th>{% trans "Year" %}</th>
- <th>{% trans "Title" %}</th>
- <th>{% trans "Type" %}</th>
- <th>{% trans "Link" %}</th>
- </tr>
- {% for author in item.author.all %}
- {% for doc in author.related_sources %}
- <tr>
- <td class='string'>{{ doc.creation_date|date:"Y"}}</td>
- <td class='string'>{{ doc.title }}</td>
- <td class='string'>{{ doc.source_type }}</td>
- <td class='string'>{% if doc.associated_url %}<a href='{{doc.associated_url}}'>{% trans "Link"%}</a>{% endif %}</td>
- </tr>
- {% endfor %}
- {% empty %}
- <tr><td colspan="4" class='no_items'>{% trans "No document associated to this person" %}</td></tr>
- {% endfor %}
-</table>
+{% if item.operation_docs_q.count %}
+{% trans "Documents associated to operations" as operation_docs %}
+{% dynamic_table_document operation_docs 'operation_docs' 'person' item.pk '' output %}
+{% endif %}
+
+{% if item.contextrecord_docs_q.count %}
+{% trans "Documents associated to context records" as context_records %}
+{% dynamic_table_document context_records 'context_records_docs' 'person' item.pk '' output %}
+{% endif %}
+
+{% if item.find_docs_q.count %}
+{% trans "Documents associated to finds" as finds_docs %}
+{% dynamic_table_document finds_docs 'finds_docs' 'person' item.pk '' output %}
+{% endif %}
{% endblock %}