Added the edit button to the transaction views in the accounting application.
This commit is contained in:
parent
0a29ffaa12
commit
6453cd4b8e
@ -42,7 +42,11 @@ First written: 2020/7/23
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{{ request.GET.r }}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back") }}
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" item.type item %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{% trans "Edit" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,11 @@ First written: 2020/7/23
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{{ request.GET.r }}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back") }}
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" item.type item %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{% trans "Edit" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
@ -42,7 +42,11 @@ First written: 2020/7/23
|
||||
<div class="btn-group btn-actions">
|
||||
<a class="btn btn-primary" role="button" href="{{ request.GET.r }}">
|
||||
<i class="fas fa-chevron-circle-left"></i>
|
||||
{{ _("Back") }}
|
||||
{% trans "Back" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" item.type item %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
{% trans "Edit" context "Navigation|" as text %}{{ text|force_escape }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
@ -137,3 +137,19 @@ def url_with_return(context, view_name, *args):
|
||||
url = reverse(view_name, args=args)
|
||||
return_to = context.request.get_full_path()
|
||||
return str(UrlBuilder(url).set_param("r", return_to))
|
||||
|
||||
|
||||
@register.simple_tag(takes_context=True)
|
||||
def url_keep_return(context, view_name, *args):
|
||||
"""Returns the transaction URL.
|
||||
|
||||
Args:
|
||||
context (RequestContext): The request context.
|
||||
view_name (str): The view name.
|
||||
*args (tuple[any]): The URL arguments.
|
||||
|
||||
Returns:
|
||||
str: The URL.
|
||||
"""
|
||||
url = reverse(view_name, args=args)
|
||||
return str(UrlBuilder(url).set_param("r", context.request.GET.get("r")))
|
||||
|
Loading…
Reference in New Issue
Block a user