summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2012-07-27 01:36:26 +0200
committerSebastian Reichel <sre@ring0.de>2012-07-27 01:36:26 +0200
commitf07de9c031d7612b8ca656c34ebce57f6856b6b2 (patch)
treea711318f19dff5e5231b7482ce4177c2c72816e6
parentffdfc69cc69503e71c0f001c3e8d8a2f06abb578 (diff)
downloadktt-inventory-system-f07de9c031d7612b8ca656c34ebce57f6856b6b2.tar.bz2
add new statistics page
-rw-r--r--inventar/templates/base.html1
-rw-r--r--inventar/templates/stats.html17
-rw-r--r--inventar/urls.py2
-rw-r--r--inventory/views.py8
-rw-r--r--static/stats.svg3
5 files changed, 31 insertions, 0 deletions
diff --git a/inventar/templates/base.html b/inventar/templates/base.html
index c61e012..d72414a 100644
--- a/inventar/templates/base.html
+++ b/inventar/templates/base.html
@@ -15,6 +15,7 @@
<ul>
<li><a href="{% url home %}"><img src="/static/home.svg" width="24" height="24" /> {% trans "Home" %}</a></li>
<li><a href="{% url admin:index %}"><img src="/static/admin.svg" width="24" height="24" /> {% trans "Admin Area" %}</a></li>
+ <li><a href="{% url stats %}"><img src="/static/stats.svg" width="24" height="24" /> {% trans "Statistics" %}</a></li>
<li><br></li>
<li>{% trans "Search Item" %}:
<ul>
diff --git a/inventar/templates/stats.html b/inventar/templates/stats.html
new file mode 100644
index 0000000..10829a7
--- /dev/null
+++ b/inventar/templates/stats.html
@@ -0,0 +1,17 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block content %}
+ <h2>Statistics:</h2>
+
+ <ul>
+ <li>Number of codes: {{ number_of_codes }}
+ <li>Number of items: {{ number_of_items }}
+ <ul>
+ <li>with parent: {{ number_of_items_with_parent }}
+ <li>without parent: {{ number_of_items_without_parent }}
+ </ul>
+ </ul>
+
+ Work in Progress...
+{% endblock %}
diff --git a/inventar/urls.py b/inventar/urls.py
index b77dae7..3510ae0 100644
--- a/inventar/urls.py
+++ b/inventar/urls.py
@@ -7,6 +7,7 @@ from inventory.views import home
from inventory.views import item
from inventory.views import search
from inventory.views import graph
+from inventory.views import stats
urlpatterns = patterns('',
url(r'^$', home, name='home'),
@@ -14,6 +15,7 @@ urlpatterns = patterns('',
url(r'^item/(?P<selectedid>[0-9A-Za-z]{4})/$', item, name='item'),
url(r'^search/(?P<term>[^/]+)/$', search, name='search'),
url(r'^graph/$', graph, name='graph'),
+ url(r'^stats/$', stats, name='stats'),
url(r'^admin/', include(admin.site.urls)),
)
diff --git a/inventory/views.py b/inventory/views.py
index 1ff6ca5..9f20d06 100644
--- a/inventory/views.py
+++ b/inventory/views.py
@@ -71,3 +71,11 @@ def graph(request):
result['Content-Type'] = "text/plain; charset=utf-8"
return result
+
+def stats(request):
+ return render_to_response('stats.html', {
+ "number_of_codes": models.Barcode.objects.count(),
+ "number_of_items": models.Item.objects.count(),
+ "number_of_items_with_parent": models.Item.objects.filter(parent__isnull=False).count(),
+ "number_of_items_without_parent": models.Item.objects.filter(parent__isnull=True).count(),
+ })
diff --git a/static/stats.svg b/static/stats.svg
new file mode 100644
index 0000000..6b7862f
--- /dev/null
+++ b/static/stats.svg
@@ -0,0 +1,3 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="98.512px" height="94.608px" viewBox="0 0 98.512 94.608" enable-background="new 0 0 98.512 94.608" xml:space="preserve">
+<polygon points="97.044,91.214 97.044,93.141 94.609,93.141 94.609,1.188 78.253,1.188 78.253,93.141 74.601,93.141 74.601,91.214 73.133,91.214 73.133,93.141 70.591,93.141 70.591,40.502 54.237,40.502 54.237,93.141 50.69,93.141 50.69,91.214 49.223,91.214 49.223,93.141 46.574,93.141 46.574,20.611 30.219,20.611 30.219,93.141 26.778,93.141 26.778,91.214 25.31,91.214 25.31,93.141 22.557,93.141 22.557,61.864 6.203,61.864 6.203,93.141 1.467,93.141 1.467,83.493 3.696,83.493 3.696,82.024 1.467,82.024 1.467,69.822 3.696,69.822 3.696,68.355 1.467,68.355 1.467,56.151 3.696,56.151 3.696,54.684 1.467,54.684 1.467,42.48 3.696,42.48 3.696,41.013 1.467,41.013 1.467,28.809 3.696,28.809 3.696,27.341 1.467,27.341 1.467,15.139 3.696,15.139 3.696,13.671 1.467,13.671 1.467,1.468 3.696,1.468 3.696,0 1.467,0 0.574,0 0.525,0 0,0 0,93.141 0,94.608 1.467,94.608 94.198,94.608 94.263,94.608 94.609,94.608 98.512,94.608 98.512,94.384 98.512,94.335 98.512,93.141 98.512,91.214 "/>
+</svg> \ No newline at end of file