Moved the period parser from the accounting application to the Mia core application.
This commit is contained in:
parent
d047be7ba9
commit
6da65f00ba
@ -29,7 +29,7 @@ from django.views import generic
|
|||||||
from django.views.decorators.http import require_GET
|
from django.views.decorators.http import require_GET
|
||||||
|
|
||||||
from accounting.models import Record
|
from accounting.models import Record
|
||||||
from accounting.utils import PeriodParser
|
from mia_core.period import PeriodParser
|
||||||
from mia import settings
|
from mia import settings
|
||||||
from mia_core.digest_auth import digest_login_required
|
from mia_core.digest_auth import digest_login_required
|
||||||
from mia_core.utils import UrlBuilder, Pagination, \
|
from mia_core.utils import UrlBuilder, Pagination, \
|
||||||
|
@ -15,16 +15,17 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
"""The utilities of the accounting application.
|
"""The utilities of the period chooser of the Mia core application.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from datetime import date
|
from datetime import date, timedelta
|
||||||
|
|
||||||
from django.template import defaultfilters
|
from django.template import defaultfilters
|
||||||
from django.utils import dateformat
|
from django.utils import dateformat
|
||||||
from django.utils.timezone import localdate, timedelta
|
from django.utils.timezone import localdate
|
||||||
from django.utils.translation import pgettext, gettext
|
from django.utils.translation import gettext, pgettext
|
||||||
|
|
||||||
|
|
||||||
class PeriodParser:
|
class PeriodParser:
|
||||||
@ -222,4 +223,4 @@ class PeriodParser:
|
|||||||
prev = date(prev_year, prev_month, 1)
|
prev = date(prev_year, prev_month, 1)
|
||||||
if year == prev.year and month == prev.month:
|
if year == prev.year and month == prev.month:
|
||||||
return gettext("Last Month")
|
return gettext("Last Month")
|
||||||
return "%d/%d" % (year, month)
|
return "%d/%d" % (year, month)
|
Loading…
Reference in New Issue
Block a user