Changed the url_with_return and url_keep_return template tags so that they work with URL instead of view names and parameters, not to mess up with the built-in url template tag in the Mia core application.
This commit is contained in:
parent
e86c150707
commit
f26b303205
@ -39,7 +39,7 @@ First written: 2020/8/8
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- the delete confirmation dialog -->
|
<!-- the delete confirmation dialog -->
|
||||||
<form action="{% url_keep_return "accounting:accounts.delete" account %}" method="post">
|
<form action="{% url "accounting:accounts.delete" account as url %}{% url_keep_return url %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div class="modal" id="del-modal">
|
<div class="modal" id="del-modal">
|
||||||
@ -141,7 +141,7 @@ First written: 2020/8/8
|
|||||||
<div class="col-sm-2">{{ _("Child Accounts:")|force_escape }}</div>
|
<div class="col-sm-2">{{ _("Child Accounts:")|force_escape }}</div>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
{% for child in account.child_set.all %}
|
{% for child in account.child_set.all %}
|
||||||
<a class="btn btn-primary" type="role" href="{% url_with_return "accounting:accounts.detail" child %}">
|
<a class="btn btn-primary" type="role" href="{% url "accounting:accounts.detail" child as url %}{% url_with_return url %}">
|
||||||
{{ child }}
|
{{ child }}
|
||||||
</a>
|
</a>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/20
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,13 +41,13 @@ First written: 2020/7/15
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/1
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -122,7 +122,7 @@ First written: 2020/7/1
|
|||||||
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
|
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
|
<a href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}" class="btn btn-info" role="button">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
|
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -138,7 +138,7 @@ First written: 2020/7/1
|
|||||||
{% for record in record_list %}
|
{% for record in record_list %}
|
||||||
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}">
|
<a class="list-group-item-action" href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}">
|
||||||
<div class="date-account-line d-flex justify-content-between align-items-center">
|
<div class="date-account-line d-flex justify-content-between align-items-center">
|
||||||
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/19
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/17
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -102,7 +102,7 @@ First written: 2020/7/17
|
|||||||
<td>{{ record.transaction.note|default:"" }}</td>
|
<td>{{ record.transaction.note|default:"" }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
|
<a href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}" class="btn btn-info" role="button">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
{{ _("View")|force_escape }}
|
{{ _("View")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -118,7 +118,7 @@ First written: 2020/7/17
|
|||||||
{% for record in record_list %}
|
{% for record in record_list %}
|
||||||
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}">
|
<a class="list-group-item-action" href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}">
|
||||||
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
|
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
|
||||||
<div class="date-account-line">
|
<div class="date-account-line">
|
||||||
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
||||||
|
@ -41,13 +41,13 @@ First written: 2020/7/16
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/16
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -123,7 +123,7 @@ First written: 2020/7/16
|
|||||||
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
|
<td class="amount {% if record.balance < 0 %} text-danger {% endif %}">{{ record.balance|accounting_amount }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
|
<a href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}" class="btn btn-info" role="button">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
|
<span class="d-none d-lg-inline">{{ _("View")|force_escape }}</span>
|
||||||
</a>
|
</a>
|
||||||
@ -139,7 +139,7 @@ First written: 2020/7/16
|
|||||||
{% for record in record_list %}
|
{% for record in record_list %}
|
||||||
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole or record.is_payable %} list-group-item-danger {% endif %}{% if record.is_existing_equipment %} list-group-item-info {% endif %}">
|
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole or record.is_payable %} list-group-item-danger {% endif %}{% if record.is_existing_equipment %} list-group-item-info {% endif %}">
|
||||||
{% if record.pk is not None %}
|
{% if record.pk is not None %}
|
||||||
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}">
|
<a class="list-group-item-action" href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}">
|
||||||
<div class="date-account-line">
|
<div class="date-account-line">
|
||||||
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
||||||
</div>
|
</div>
|
||||||
|
@ -41,13 +41,13 @@ First written: 2020/7/21
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@ -100,7 +100,7 @@ First written: 2020/7/21
|
|||||||
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
|
<td class="amount">{{ record.credit_amount|accounting_amount }}</td>
|
||||||
<td>{{ record.transaction.notes|default:"" }}</td>
|
<td>{{ record.transaction.notes|default:"" }}</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<a href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}" class="btn btn-info" role="button">
|
<a href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}" class="btn btn-info" role="button">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
{{ _("View")|force_escape }}
|
{{ _("View")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -114,7 +114,7 @@ First written: 2020/7/21
|
|||||||
<ul class="list-group d-md-none">
|
<ul class="list-group d-md-none">
|
||||||
{% for record in record_list %}
|
{% for record in record_list %}
|
||||||
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
<li class="list-group-item {% if not record.is_balanced or record.has_order_hole %} list-group-item-danger {% endif %}">
|
||||||
<a class="list-group-item-action" href="{% url_with_return "accounting:transactions.detail" record.transaction.type record.transaction %}">
|
<a class="list-group-item-action" href="{% url "accounting:transactions.detail" record.transaction.type record.transaction as url %}{% url_with_return url %}">
|
||||||
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
|
<div class="{% if record.is_credit %} journal-credit {% else %} journal-debit {% endif %}">
|
||||||
<div class="date-account-line">
|
<div class="date-account-line">
|
||||||
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
{{ record.transaction.date|smart_date }} {{ record.account.title|title_case }}
|
||||||
|
@ -55,7 +55,7 @@ First written: 2020/8/6
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if txn_list|length > 1 %}
|
{% if txn_list|length > 1 %}
|
||||||
<form action="{% url_keep_return "accounting:transactions.sort" date %}" method="post">
|
<form action="{% url "accounting:transactions.sort" date as url %}{% url_keep_return url %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<table class="table general-journal-table">
|
<table class="table general-journal-table">
|
||||||
<thead>
|
<thead>
|
||||||
@ -75,7 +75,7 @@ First written: 2020/8/6
|
|||||||
<button class="btn btn-outline-secondary" type="button">
|
<button class="btn btn-outline-secondary" type="button">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
</button>
|
</button>
|
||||||
<a class="btn btn-primary" role="button" href="{% url_with_return "accounting:transactions.detail" txn.type txn %}">
|
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.detail" txn.type txn as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-eye"></i>
|
<i class="fas fa-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,7 +40,7 @@ First written: 2020/7/23
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- the delete confirmation dialog -->
|
<!-- the delete confirmation dialog -->
|
||||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
<form action="{% url "accounting:transactions.delete" txn as url %}{% url_keep_return url %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div class="modal" id="del-modal">
|
<div class="modal" id="del-modal">
|
||||||
@ -71,7 +71,7 @@ First written: 2020/7/23
|
|||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "expense" txn %}">
|
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.edit" "expense" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
{{ _("Edit")|force_escape }}
|
{{ _("Edit")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -81,12 +81,12 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.detail" "transfer" txn %}">
|
<a class="btn btn-primary d-none d-sm-inline" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-exchange-alt"></i>
|
<i class="fas fa-exchange-alt"></i>
|
||||||
{{ _("To Transfer")|force_escape }}
|
{{ _("To Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -101,12 +101,12 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.detail" "transfer" txn %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-exchange-alt"></i>
|
<i class="fas fa-exchange-alt"></i>
|
||||||
{{ _("To Transfer")|force_escape }}
|
{{ _("To Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -40,7 +40,7 @@ First written: 2020/7/23
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- the delete confirmation dialog -->
|
<!-- the delete confirmation dialog -->
|
||||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
<form action="{% url "accounting:transactions.delete" txn as url %}{% url_keep_return url %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div class="modal" id="del-modal">
|
<div class="modal" id="del-modal">
|
||||||
@ -71,7 +71,7 @@ First written: 2020/7/23
|
|||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "income" txn %}">
|
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.edit" "income" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
{{ _("Edit")|force_escape }}
|
{{ _("Edit")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -81,12 +81,12 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="btn btn-primary d-none d-sm-inline" href="{% url_keep_return "accounting:transactions.detail" "transfer" txn %}">
|
<a class="btn btn-primary d-none d-sm-inline" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-exchange-alt"></i>
|
<i class="fas fa-exchange-alt"></i>
|
||||||
{{ _("To Transfer")|force_escape }}
|
{{ _("To Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -101,12 +101,12 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a class="dropdown-item" href="{% url_keep_return "accounting:transactions.detail" "transfer" txn %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.detail" "transfer" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-exchange-alt"></i>
|
<i class="fas fa-exchange-alt"></i>
|
||||||
{{ _("To Transfer")|force_escape }}
|
{{ _("To Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -40,7 +40,7 @@ First written: 2020/7/23
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<!-- the delete confirmation dialog -->
|
<!-- the delete confirmation dialog -->
|
||||||
<form action="{% url_keep_return "accounting:transactions.delete" txn %}" method="post">
|
<form action="{% url "accounting:transactions.delete" txn as url %}{% url_keep_return url %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<!-- The Modal -->
|
<!-- The Modal -->
|
||||||
<div class="modal" id="del-modal">
|
<div class="modal" id="del-modal">
|
||||||
@ -71,7 +71,7 @@ First written: 2020/7/23
|
|||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="btn btn-primary" role="button" href="{% url_keep_return "accounting:transactions.edit" "transfer" txn %}">
|
<a class="btn btn-primary" role="button" href="{% url "accounting:transactions.edit" "transfer" txn as url %}{% url_keep_return url %}">
|
||||||
<i class="fas fa-edit"></i>
|
<i class="fas fa-edit"></i>
|
||||||
{{ _("Edit")|force_escape }}
|
{{ _("Edit")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -81,7 +81,7 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="btn btn-primary d-none d-sm-inline" role="button" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -97,7 +97,7 @@ First written: 2020/7/23
|
|||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.sort" txn.date %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.sort" txn.date as url %}{% url_with_return url %}">
|
||||||
<i class="fas fa-sort"></i>
|
<i class="fas fa-sort"></i>
|
||||||
{{ _("Sort")|force_escape }}
|
{{ _("Sort")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
|
@ -46,7 +46,7 @@ First written: 2020/7/23
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="btn-group btn-actions">
|
<div class="btn-group btn-actions">
|
||||||
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url_keep_return "accounting:transactions.detail" "expense" form.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url "accounting:transactions.detail" "expense" form.transaction as url %}{% url_keep_return url %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -55,7 +55,7 @@ First written: 2020/7/23
|
|||||||
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
||||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||||
<form id="txn-form" action="{% if form.transaction %}{% url_keep_return "accounting:transactions.update" "expense" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">
|
<form id="txn-form" action="{% if form.transaction %}{% url "accounting:transactions.update" "expense" form.transaction as url %}{% url_keep_return url %}{% else %}{% url "accounting:transactions.store" "expense" as url %}{% url_keep_return url %}{% endif %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
@ -46,7 +46,7 @@ First written: 2020/7/23
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="btn-group btn-actions">
|
<div class="btn-group btn-actions">
|
||||||
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url_keep_return "accounting:transactions.detail" "income" form.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url "accounting:transactions.detail" "income" form.transaction as url %}{% url_keep_return url %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -55,7 +55,7 @@ First written: 2020/7/23
|
|||||||
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
||||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||||
<form id="txn-form" action="{% if form.transaction %}{% url_keep_return "accounting:transactions.update" "income" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">
|
<form id="txn-form" action="{% if form.transaction %}{% url "accounting:transactions.update" "income" form.transaction as url %}{% url_keep_return url %}{% else %}{% url "accounting:transactions.store" "income" as url %}{% url_keep_return url %}{% endif %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
@ -46,7 +46,7 @@ First written: 2020/7/23
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="btn-group btn-actions">
|
<div class="btn-group btn-actions">
|
||||||
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url_keep_return "accounting:transactions.detail" "transfer" form.transaction %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
<a class="btn btn-primary" role="button" href="{% if form.transaction %}{% url "accounting:transactions.detail" "transfer" form.transaction as url %}{% url_keep_return url %}{% elif request.GET.r %}{{ request.GET.r }}{% else %}{% url "accounting:home" %}{% endif %}">
|
||||||
<i class="fas fa-chevron-circle-left"></i>
|
<i class="fas fa-chevron-circle-left"></i>
|
||||||
{{ _("Back")|force_escape }}
|
{{ _("Back")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
@ -55,7 +55,7 @@ First written: 2020/7/23
|
|||||||
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
<input id="account-option-url" type="hidden" value="{% url "accounting:api.accounts.options" %}" />
|
||||||
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
<input id="summary-categories" type="hidden" value="{{ summary_categories }}" />
|
||||||
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
<input id="new-record-template" type="hidden" value="{{ new_record_template }}" />
|
||||||
<form id="txn-form" action="{% if form.transaction %}{% url_keep_return "accounting:transactions.update" "transfer" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">
|
<form id="txn-form" action="{% if form.transaction %}{% url "accounting:transactions.update" "transfer" form.transaction as url %}{% url_keep_return url %}{% else %}{% url "accounting:transactions.store" "transfer" as url %}{% url_keep_return url %}{% endif %}" method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<div class="row form-group">
|
<div class="row form-group">
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
|
@ -42,13 +42,13 @@ First written: 2020/7/19
|
|||||||
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
{% trans "New" context "Accounting" as text %}{{ text|force_escape }}
|
||||||
</button>
|
</button>
|
||||||
<div class="dropdown-menu">
|
<div class="dropdown-menu">
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "expense" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "expense" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Expense")|force_escape }}
|
{{ _("Cash Expense")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "income" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "income" as url %}{% url_with_return url %}">
|
||||||
{{ _("Cash Income")|force_escape }}
|
{{ _("Cash Income")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item" href="{% url_with_return "accounting:transactions.create" "transfer" %}">
|
<a class="dropdown-item" href="{% url "accounting:transactions.create" "transfer" as url %}{% url_with_return url %}">
|
||||||
{{ _("Transfer")|force_escape }}
|
{{ _("Transfer")|force_escape }}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -83,35 +83,33 @@ def url_period(context, period_spec):
|
|||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def url_with_return(context, view_name, *args):
|
def url_with_return(context, url):
|
||||||
"""Returns the transaction URL.
|
"""Returns the URL with the current page added as the "r" query parameter,
|
||||||
|
so that returning to this page is possible.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
context (RequestContext): The request context.
|
context (RequestContext): The request context.
|
||||||
view_name (str): The view name.
|
url (str): The URL.
|
||||||
*args (tuple[any]): The URL arguments.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: The URL.
|
str: The URL with the current page added as the "r" query parameter.
|
||||||
"""
|
"""
|
||||||
url = reverse(view_name, args=args)
|
|
||||||
return str(UrlBuilder(url).query(
|
return str(UrlBuilder(url).query(
|
||||||
r=str(UrlBuilder(context.request.get_full_path()).remove("s"))))
|
r=str(UrlBuilder(context.request.get_full_path()).remove("s"))))
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag(takes_context=True)
|
@register.simple_tag(takes_context=True)
|
||||||
def url_keep_return(context, view_name, *args):
|
def url_keep_return(context, url):
|
||||||
"""Returns the transaction URL.
|
"""Returns the URL with the current "r" query parameter set, so that the
|
||||||
|
next processor can still return to the same page.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
context (RequestContext): The request context.
|
context (RequestContext): The request context.
|
||||||
view_name (str): The view name.
|
url (str): The URL.
|
||||||
*args (tuple[any]): The URL arguments.
|
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
str: The URL.
|
str: The URL with the current "r" query parameter set.
|
||||||
"""
|
"""
|
||||||
url = reverse(view_name, args=args)
|
|
||||||
return str(UrlBuilder(url).query(r=context.request.GET.get("r")))
|
return str(UrlBuilder(url).query(r=context.request.GET.get("r")))
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user