diff options
| 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 |
| commit | 37cb695ba14761c5c579ace7797dcd99f5b486c2 (patch) | |
| tree | e27f01bf29b9fe16dfccc157f2a1f2d6fcb872e4 /archaeological_operations/models.py | |
| parent | 2ff0b6a2d4e1f862a44774d56c84a9b9d39fe923 (diff) | |
| download | Ishtar-37cb695ba14761c5c579ace7797dcd99f5b486c2.tar.bz2 Ishtar-37cb695ba14761c5c579ace7797dcd99f5b486c2.zip | |
Display dynamicaly large tables in windows
Diffstat (limited to 'archaeological_operations/models.py')
| -rw-r--r-- | archaeological_operations/models.py | 12 |
1 files changed, 12 insertions, 0 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: |
