diff options
author | keroth <keroth@janssen-jan.de> | 2015-05-10 00:10:26 +0200 |
---|---|---|
committer | keroth <keroth@janssen-jan.de> | 2015-05-10 00:10:26 +0200 |
commit | c7fd8c443357879aab51134e6679ace45baec103 (patch) | |
tree | 29b8e55b352ea8b22207cc6bb8b9ebb8d97745a9 /inventar | |
parent | b518d7011419a3c9e5d2352eab21020cb6031d29 (diff) | |
download | ktt-inventory-system-c7fd8c443357879aab51134e6679ace45baec103.tar.bz2 |
Added file support
Diffstat (limited to 'inventar')
-rw-r--r-- | inventar/templates/base.html | 3 | ||||
-rw-r--r-- | inventar/templates/item.html | 6 | ||||
-rw-r--r-- | inventar/templates/upload.html | 20 | ||||
-rw-r--r-- | inventar/urls.py | 3 |
4 files changed, 27 insertions, 5 deletions
diff --git a/inventar/templates/base.html b/inventar/templates/base.html index 6883023..8304687 100644 --- a/inventar/templates/base.html +++ b/inventar/templates/base.html @@ -16,10 +16,11 @@ <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><a href="{% url "upload" %}"><img src="/static/stats.svg" width="24" height="24" /> {% trans "Upload" %}</a></li> <li><br></li> <li>{% trans "Search Item" %}: <ul> - <li><form action="?" target="_self" id="itemchooser" onsubmit="location.assign('/item/'+document.forms['itemchooser']['id'].value+'/'); return false;"><input maxlength="5" name="id" type="text" title="{% trans "Get Item by ID" %}"/></form></li> + <li><form action="?" target="_self" id="itemchooser" onsubmit="location.assign('/item/'+document.forms['itemchooser']['id'].value+'/'); return false;"><input maxlength="4" name="id" type="text" title="{% trans "Get Item by ID" %}"/></form></li> <li><form action="?" target="_self" id="itemsearch" onsubmit="location.assign('/search/'+document.forms['itemsearch']['term'].value+'/'); return false;"><input name="term" type="text" title="{% trans "Search Item by Name and Description" %}"/></form></li> </ul> </li> diff --git a/inventar/templates/item.html b/inventar/templates/item.html index 86845e3..28343e0 100644 --- a/inventar/templates/item.html +++ b/inventar/templates/item.html @@ -3,7 +3,7 @@ {% block content %} {% if user.is_authenticated %} - <h1>{{ name }} <a href="{% url admin:inventory_item_change id %}"><img src="/static/edit.svg" width="20" height="20" alt="[edit]"/></a></h1> + <h1>{{ name }} <a href="{% url "admin:inventory_item_change" id %}"><img src="/static/edit.svg" width="20" height="20" alt="[edit]"/></a></h1> {% else %} <h1>{{ name }}</h1> {% endif %} @@ -52,7 +52,7 @@ <td> {% for p in parentpath %} {% if p.one_barcode %} - <ul class="path"><li><a href="{% url item selectedid=p.one_barcode %}">{{ p.name }} [{{ p.barcodes }}]</a> + <ul class="path"><li><a href="{% url "item selectedid=p.one_barcode" %}">{{ p.name }} [{{ p.barcodes }}]</a> {% else %} <ul class="path"><li>{{ p.name }} [{{ p.barcodes }}] {% endif %} @@ -69,7 +69,7 @@ <td> {% for p in temporary_parentpath %} {% if p.one_barcode %} - <ul class="path"><li><a href="{% url item selectedid=p.one_barcode %}">{{ p.name }} [{{ p.barcodes }}]</a> + <ul class="path"><li><a href="{% url "item selectedid=p.one_barcode" %}">{{ p.name }} [{{ p.barcodes }}]</a> {% else %} <ul class="path"><li>{{ p.name }} [{{ p.barcodes }}] {% endif %} diff --git a/inventar/templates/upload.html b/inventar/templates/upload.html new file mode 100644 index 0000000..5371020 --- /dev/null +++ b/inventar/templates/upload.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} + {% if user.is_authenticated %} + <h2>Upload new Parent Tree:</h2> + + <form enctype="multipart/form-data" method="post" action="/upload/">{% csrf_token %} + {{form}} + <input type="submit" value="Submit" /> + <ul class="path"> + {% for code in data %} + <li>{{ code }} + {% endfor %} + {% for code in data %} + </li> + {% endfor %} + </ul> + {% endif %} +{% endblock %} diff --git a/inventar/urls.py b/inventar/urls.py index 23a2d4b..ffb1757 100644 --- a/inventar/urls.py +++ b/inventar/urls.py @@ -10,16 +10,17 @@ from inventory.views import item from inventory.views import search from inventory.views import graph from inventory.views import stats +from inventory.views import upload urlpatterns = patterns('', url(r'^$', home, name='home'), - #(r'^openid/', include('django_openid_auth.urls')), 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'^upload/$', upload, name='upload'), url(r'^admin/', include(admin.site.urls)), ) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) |