Revised the names of the API views in the accounting application.

This commit is contained in:
依瑪貓 2020-08-09 14:20:59 +08:00
parent 5c7636d37e
commit 375f0db9e0
6 changed files with 10 additions and 10 deletions

View File

@ -41,7 +41,7 @@ First written: 2020/8/8
<form id="account-form" action="{% if request.resolver_match.kwargs.account %}{% url "accounting:accounts.update" request.resolver_match.kwargs.account %}{% else %}{% url "accounting:accounts.store" %}{% endif %}" method="post"> <form id="account-form" action="{% if request.resolver_match.kwargs.account %}{% url "accounting:accounts.update" request.resolver_match.kwargs.account %}{% else %}{% url "accounting:accounts.store" %}{% endif %}" method="post">
{% csrf_token %} {% csrf_token %}
<input id="all-account-url" type="hidden" value="{% url "accounting:api.accounts.all" %}" /> <input id="all-account-url" type="hidden" value="{% url "accounting:api.accounts" %}" />
<input id="account-code-original" type="hidden" value="{% if request.resolver_match.kwargs.account %}{{ request.resolver_match.kwargs.account.code }}{% endif %}" /> <input id="account-code-original" type="hidden" value="{% if request.resolver_match.kwargs.account %}{{ request.resolver_match.kwargs.account.code }}{% endif %}" />
<div class="row form-group"> <div class="row form-group">
<label class="col-sm-2" for="account-parent">{{ _("Parent Account:")|force_escape }}</label> <label class="col-sm-2" for="account-parent">{{ _("Parent Account:")|force_escape }}</label>

View File

@ -52,7 +52,7 @@ First written: 2020/7/23
</a> </a>
</div> </div>
<input id="account-option-url" type="hidden" value="{% url "accounting: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_keep_return "accounting:transactions.update" "expense" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "expense" %}{% endif %}" method="post">

View File

@ -52,7 +52,7 @@ First written: 2020/7/23
</a> </a>
</div> </div>
<input id="account-option-url" type="hidden" value="{% url "accounting: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_keep_return "accounting:transactions.update" "income" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "income" %}{% endif %}" method="post">

View File

@ -52,7 +52,7 @@ First written: 2020/7/23
</a> </a>
</div> </div>
<input id="account-option-url" type="hidden" value="{% url "accounting: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_keep_return "accounting:transactions.update" "transfer" form.transaction %}{% else %}{% url_keep_return "accounting:transactions.store" "transfer" %}{% endif %}" method="post">

View File

@ -97,10 +97,10 @@ urlpatterns = [
# TODO: To be done # TODO: To be done
path("accounts/store", path("accounts/store",
mia_core_views.todo, name="accounts.store"), mia_core_views.todo, name="accounts.store"),
path("api/accounts/all", path("api/accounts",
views.api_account_all, name="api.accounts.all"), views.api_account_list, name="api.accounts"),
path("accounts/options", path("api/accounts/options",
views.account_options, name="accounts.options"), views.api_account_options, name="api.accounts.options"),
path("accounts/<account:account>", path("accounts/<account:account>",
views.AccountView.as_view(), name="accounts.detail"), views.AccountView.as_view(), name="accounts.detail"),
path("accounts/<account:account>/edit", path("accounts/<account:account>/edit",

View File

@ -1060,7 +1060,7 @@ def account_form(request, account=None):
@require_GET @require_GET
@login_required @login_required
def api_account_all(request): def api_account_list(request):
"""The API view to return all the accounts. """The API view to return all the accounts.
Args: Args:
@ -1074,7 +1074,7 @@ def api_account_all(request):
@require_GET @require_GET
@login_required @login_required
def account_options(request): def api_account_options(request):
"""The view to return the account options. """The view to return the account options.
Args: Args: