summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2016-05-22 22:22:32 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2016-05-22 22:22:32 +0200
commite45b6042dd31f046226e29ad07e1638c7ff3b437 (patch)
treea4d6b2acc1167a30f51966f3da9df21eca1dfebc /archaeological_finds
parenta35bb6b362f99f7b2c3d38dc8bbc54f234ac4dd7 (diff)
downloadIshtar-e45b6042dd31f046226e29ad07e1638c7ff3b437.tar.bz2
Ishtar-e45b6042dd31f046226e29ad07e1638c7ff3b437.zip
Find: sheet for basket - manage default basket selection
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/models.py7
-rw-r--r--archaeological_finds/templates/ishtar/sheet_findbasket.html16
-rw-r--r--archaeological_finds/templates/ishtar/sheet_findbasket_pdf.html18
-rw-r--r--archaeological_finds/templates/ishtar/sheet_findbasket_window.html3
-rw-r--r--archaeological_finds/urls.py5
-rw-r--r--archaeological_finds/views.py3
6 files changed, 48 insertions, 4 deletions
diff --git a/archaeological_finds/models.py b/archaeological_finds/models.py
index af3009351..43c18828c 100644
--- a/archaeological_finds/models.py
+++ b/archaeological_finds/models.py
@@ -384,6 +384,10 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
lbl += u' ({})'.format(base)
return lbl
+ @classmethod
+ def get_owns(cls, user):
+ return FindBasket.objects.filter(user=user)
+
def get_first_base_find(self):
q = self.base_finds
if not q.count():
@@ -541,7 +545,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
class FindBasket(Basket):
- items = models.ManyToManyField(Find, blank=True, null=True)
+ items = models.ManyToManyField(Find, blank=True, null=True,
+ related_name='basket')
class FindSource(Source):
diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket.html b/archaeological_finds/templates/ishtar/sheet_findbasket.html
new file mode 100644
index 000000000..00b52ab7b
--- /dev/null
+++ b/archaeological_finds/templates/ishtar/sheet_findbasket.html
@@ -0,0 +1,16 @@
+{% extends "ishtar/sheet.html" %}
+{% load i18n window_tables from_dict %}
+
+{% block head_sheet %}
+{{block.super}}
+<h1>{% trans "Find"%}</h1>
+{% endblock %}
+
+{% block content %}
+
+<div class='tool'>{%trans "Export as:"%} <a href='{% url show-findbasket item.pk "odt" %}'>{%trans "OpenOffice.org file"%}</a>, <a href='{% url show-findbasket item.pk "pdf" %}'>{%trans "PDF file"%}</a></div>
+<div class='tool modify'><a href='{% url select_itemsinbasket item.pk %}'>{% trans "Modify" %}</a></div>
+
+{% dynamic_table_document_large finds 'finds_for_ope' 'basket' item.pk 'TABLE_COLS_FOR_OPE' output %}
+
+{% endblock %}
diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket_pdf.html b/archaeological_finds/templates/ishtar/sheet_findbasket_pdf.html
new file mode 100644
index 000000000..37eecf81b
--- /dev/null
+++ b/archaeological_finds/templates/ishtar/sheet_findbasket_pdf.html
@@ -0,0 +1,18 @@
+{% extends "ishtar/sheet_findbasket.html" %}
+{% block header %}
+<link rel="stylesheet" href="{{STATIC_URL}}/media/style_basic.css" />
+{% endblock %}
+{% block main_head %}
+{{ block.super }}
+<div id="pdfheader">
+Ishtar &ndash; {{APP_NAME}} &ndash; {{item}}
+</div>
+{% endblock %}
+{%block head_sheet%}{%endblock%}
+{%block main_foot%}
+<div id="pdffooter">
+&ndash; <pdf:pagenumber/> &ndash;
+</div>
+</body>
+</html>
+{%endblock%}
diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket_window.html b/archaeological_finds/templates/ishtar/sheet_findbasket_window.html
new file mode 100644
index 000000000..5bc46d5c7
--- /dev/null
+++ b/archaeological_finds/templates/ishtar/sheet_findbasket_window.html
@@ -0,0 +1,3 @@
+{% extends "ishtar/sheet_findbasket.html" %}
+{% block main_head %}{%endblock%}
+{% block main_foot %}{%endblock%}
diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py
index deaaaff18..27a2bdc76 100644
--- a/archaeological_finds/urls.py
+++ b/archaeological_finds/urls.py
@@ -58,9 +58,6 @@ urlpatterns = patterns(
url(r'^find_basket_creation/$',
check_rights(['change_find', 'change_own_find'])(
views.NewFindBasketView.as_view()), name='new_findbasket'),
- url(r'^find_basket_creation/$',
- check_rights(['change_find', 'change_own_find'])(
- views.NewFindBasketView.as_view()), name='new_findbasket'),
url(r'^find_basket_modification_add/$',
check_rights(['change_find', 'change_own_find'])(
views.SelectBasketForManagement.as_view()),
@@ -113,6 +110,8 @@ urlpatterns += patterns(
'get_findsource', name='get-findsource'),
url(r'show-findsource(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_findsource',
name=models.FindSource.SHOW_URL),
+ url(r'show-find/basket-(?P<pk>.+)/(?P<type>.+)?$', 'show_findbasket',
+ name='show-findbasket'),
url(r'show-find(?:/(?P<pk>.+))?/(?P<type>.+)?$', 'show_find',
name=models.Find.SHOW_URL),
url(r'show-historized-find/(?P<pk>.+)?/(?P<date>.+)?$',
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 871a5b90d..77d3522ca 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -62,6 +62,7 @@ find_extra_keys = {
'base_finds__find__description':
'base_finds__find__description__icontains',
'base_finds__batch': 'base_finds__batch',
+ 'basket': 'basket',
'image': 'image__isnull'}
get_find = get_item(
@@ -95,6 +96,8 @@ get_findsource = get_item(
show_find = show_item(models.Find, 'find')
revert_find = revert_item(models.Find)
+show_findbasket = show_item(models.FindBasket, 'findbasket')
+
find_creation_wizard = FindWizard.as_view([
('selecrecord-find_creation', RecordFormSelection),
('find-find_creation', FindForm),