From 760f074f49cda70b7de819003e088f057bfc9559 Mon Sep 17 00:00:00 2001 From: Mateusz Piotrowski Date: Sun, 8 Oct 2017 00:08:00 +0200 Subject: [PATCH] Add a button to add a child from item view --- storage/admin.py | 3 ++- storage/templates/item.html | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/storage/admin.py b/storage/admin.py index ec0a231..5085253 100644 --- a/storage/admin.py +++ b/storage/admin.py @@ -43,8 +43,9 @@ class ItemAdmin(admin.ModelAdmin): def get_changeform_initial_data(self, request): data = { - 'parent': request.session.get('last-parent') + 'parent': request.GET.get('parent') or request.session.get('last-parent') } + data.update(super(ItemAdmin, self).get_changeform_initial_data(request)) return data diff --git a/storage/templates/item.html b/storage/templates/item.html index 03401c7..e74dbd2 100644 --- a/storage/templates/item.html +++ b/storage/templates/item.html @@ -83,6 +83,9 @@ {% empty %} No children {% endfor %} + + +