mirror of
https://github.com/netbox-community/netbox.git
synced 2025-09-06 06:13:36 -06:00
add optional return_url parameter to "Add" button, used by missing_prerequisites.html to return user back to initial page
This commit is contained in:
parent
ab0a1f0bbc
commit
639c5e8052
@ -10,7 +10,7 @@
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
<div>
|
||||
{% add_button prerequisite_model %}
|
||||
{% add_button prerequisite_model request.path %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,6 +1,10 @@
|
||||
{% if url %}
|
||||
{% load i18n %}
|
||||
<a href="{{ url }}" type="button" class="btn btn-primary">
|
||||
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %}
|
||||
</a>
|
||||
{% endif %}
|
||||
{% load i18n %}
|
||||
{% if return_url %}
|
||||
<a href="{{ url }}?return_url={{ return_url }}" type="button" class="btn btn-primary">
|
||||
{% else %}
|
||||
<a href="{{ url }}" type="button" class="btn btn-primary">
|
||||
{% endif %}
|
||||
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %}
|
||||
</a>
|
||||
{% endif %}
|
@ -146,7 +146,7 @@ def sync_button(instance):
|
||||
#
|
||||
|
||||
@register.inclusion_tag('buttons/add.html')
|
||||
def add_button(model, action='add'):
|
||||
def add_button(model, return_url=None, action='add'):
|
||||
try:
|
||||
url = reverse(get_viewname(model, action))
|
||||
except NoReverseMatch:
|
||||
@ -154,6 +154,7 @@ def add_button(model, action='add'):
|
||||
|
||||
return {
|
||||
'url': url,
|
||||
'return_url': return_url,
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user