Add a button to add a child from item view
This commit is contained in:
parent
a65c652647
commit
760f074f49
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue