Moved the period parser from the accounting application to the Mia core application.

This commit is contained in:
依瑪貓 2020-07-08 07:20:08 +08:00
parent d047be7ba9
commit 6da65f00ba
2 changed files with 7 additions and 6 deletions

View File

@ -29,7 +29,7 @@ from django.views import generic
from django.views.decorators.http import require_GET
from accounting.models import Record
from accounting.utils import PeriodParser
from mia_core.period import PeriodParser
from mia import settings
from mia_core.digest_auth import digest_login_required
from mia_core.utils import UrlBuilder, Pagination, \

View File

@ -15,16 +15,17 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""The utilities of the accounting application.
"""The utilities of the period chooser of the Mia core application.
"""
import re
from datetime import date
from datetime import date, timedelta
from django.template import defaultfilters
from django.utils import dateformat
from django.utils.timezone import localdate, timedelta
from django.utils.translation import pgettext, gettext
from django.utils.timezone import localdate
from django.utils.translation import gettext, pgettext
class PeriodParser:
@ -222,4 +223,4 @@ class PeriodParser:
prev = date(prev_year, prev_month, 1)
if year == prev.year and month == prev.month:
return gettext("Last Month")
return "%d/%d" % (year, month)
return "%d/%d" % (year, month)