1
0
Fork 0

Add a button to add a child from item view

This commit is contained in:
Mateusz Piotrowski 2017-10-08 00:08:00 +02:00 committed by Piotr Dobrowolski
parent a65c652647
commit 760f074f49
2 changed files with 5 additions and 1 deletions

View File

@ -43,8 +43,9 @@ class ItemAdmin(admin.ModelAdmin):
def get_changeform_initial_data(self, request): def get_changeform_initial_data(self, request):
data = { 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)) data.update(super(ItemAdmin, self).get_changeform_initial_data(request))
return data return data

View File

@ -83,6 +83,9 @@
{% empty %} {% empty %}
<tr><td colspan=2>No children</td></tr> <tr><td colspan=2>No children</td></tr>
{% endfor %} {% endfor %}
<tr><td colspan=2>
<a href="/admin/storage/item/add?parent={{ item.uuid }}" %}"><span class="glyphicon glyphicon-plus"></span></a>
</td></tr>
</table> </table>
</div> </div>
</div> </div>