Moved the views back to accounting.views in the accounting application.

This commit is contained in:
依瑪貓 2020-07-23 14:17:05 +08:00
parent 79442085b6
commit 6691e3db2b
3 changed files with 34 additions and 61 deletions

View File

@ -22,8 +22,7 @@
from django.urls import path, register_converter from django.urls import path, register_converter
from mia_core import views as mia_core_views from mia_core import views as mia_core_views
from . import views, converters from . import converters, views
from .views import reports
register_converter(converters.TransactionTypeConverter, "txn-type") register_converter(converters.TransactionTypeConverter, "txn-type")
register_converter(converters.PeriodConverter, "period") register_converter(converters.PeriodConverter, "period")
@ -33,39 +32,39 @@ register_converter(converters.LedgerAccountConverter, "ledger-account")
app_name = "accounting" app_name = "accounting"
urlpatterns = [ urlpatterns = [
path("", views.home, name="home"), path("", views.home, name="home"),
path("cash", reports.cash_default, name="cash.home"), path("cash", views.cash_default, name="cash.home"),
path("cash/<cash-account:account>/<period:period>", path("cash/<cash-account:account>/<period:period>",
reports.cash, name="cash"), views.cash, name="cash"),
path("cash-summary", path("cash-summary",
reports.cash_summary_default, name="cash-summary.home"), views.cash_summary_default, name="cash-summary.home"),
path("cash-summary/<cash-account:account>", path("cash-summary/<cash-account:account>",
reports.cash_summary, name="cash-summary"), views.cash_summary, name="cash-summary"),
path("ledger", path("ledger",
reports.ledger_default, name="ledger.home"), views.ledger_default, name="ledger.home"),
path("ledger/<ledger-account:account>/<period:period>", path("ledger/<ledger-account:account>/<period:period>",
reports.ledger, name="ledger"), views.ledger, name="ledger"),
path("ledger-summary", path("ledger-summary",
reports.ledger_summary_default, name="ledger-summary.home"), views.ledger_summary_default, name="ledger-summary.home"),
path("ledger-summary/<ledger-account:account>", path("ledger-summary/<ledger-account:account>",
reports.ledger_summary, name="ledger-summary"), views.ledger_summary, name="ledger-summary"),
path("journal", path("journal",
reports.journal_default, name="journal.home"), views.journal_default, name="journal.home"),
path("journal/<period:period>", path("journal/<period:period>",
reports.journal, name="journal"), views.journal, name="journal"),
path("trial-balance", path("trial-balance",
reports.trial_balance_default, name="trial-balance.home"), views.trial_balance_default, name="trial-balance.home"),
path("trial-balance/<period:period>", path("trial-balance/<period:period>",
reports.trial_balance, name="trial-balance"), views.trial_balance, name="trial-balance"),
path("income-statement", path("income-statement",
reports.income_statement_default, name="income-statement.home"), views.income_statement_default, name="income-statement.home"),
path("income-statement/<period:period>", path("income-statement/<period:period>",
reports.income_statement, name="income-statement"), views.income_statement, name="income-statement"),
path("balance-sheet", path("balance-sheet",
reports.balance_sheet_default, name="balance-sheet.home"), views.balance_sheet_default, name="balance-sheet.home"),
path("balance-sheet/<period:period>", path("balance-sheet/<period:period>",
reports.balance_sheet, name="balance-sheet"), views.balance_sheet, name="balance-sheet"),
path("search", path("search",
reports.search, name="search"), views.search, name="search"),
path("transactions/<txn-type:type>/create", path("transactions/<txn-type:type>/create",
mia_core_views.todo, name="transactions.create"), mia_core_views.todo, name="transactions.create"),
path("transactions/<txn-type:type>/store", path("transactions/<txn-type:type>/store",

View File

@ -39,6 +39,22 @@ from mia_core.period import Period
from mia_core.utils import Pagination, get_multi_lingual_search from mia_core.utils import Pagination, get_multi_lingual_search
# noinspection PyUnusedLocal
@require_GET
@digest_login_required
def home(request):
"""The accounting home page.
Args:
request (HttpRequest) The request.
Returns:
HttpResponseRedirect: The redirection to the default
accounting report.
"""
return HttpResponseRedirect(reverse("accounting:cash.home"))
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
@require_GET @require_GET
@digest_login_required @digest_login_required

View File

@ -1,42 +0,0 @@
# The accounting application of the Mia project.
# by imacat <imacat@mail.imacat.idv.tw>, 2020/6/30
# Copyright (c) 2020 imacat.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""The view controllers of the accounting application.
"""
from django.http import HttpResponseRedirect
from django.urls import reverse
from django.views.decorators.http import require_GET
from mia_core.digest_auth import digest_login_required
# noinspection PyUnusedLocal
@require_GET
@digest_login_required
def home(request):
"""The accounting home page.
Args:
request (HttpRequest) The request.
Returns:
HttpResponseRedirect: The redirection to the default
accounting report.
"""
return HttpResponseRedirect(reverse("accounting:cash.home"))