Add model to global template context, plus h.maxlen()

sometimes it's nice to just add a `maxlength="100"` or whatever to an input tag
within some random template.  that should "just be possible" with no extra
effort
This commit is contained in:
Lance Edgar 2020-08-09 14:03:28 -05:00
parent 7d158e58b5
commit 4371574403
2 changed files with 3 additions and 1 deletions

View file

@ -32,6 +32,7 @@ from decimal import Decimal
from rattail.time import localtime, make_utc
from rattail.util import (pretty_quantity, pretty_hours, hours_as_decimal,
OrderedDict)
from rattail.db.util import maxlen
from webhelpers2.html import *
from webhelpers2.html.tags import *

View file

@ -2,7 +2,7 @@
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2019 Lance Edgar
# Copyright © 2010-2020 Lance Edgar
#
# This file is part of Rattail.
#
@ -99,6 +99,7 @@ def before_render(event):
renderer_globals['url'] = request.route_url
renderer_globals['rattail'] = rattail
renderer_globals['tailbone'] = tailbone
renderer_globals['model'] = request.rattail_config.get_model()
renderer_globals['enum'] = request.rattail_config.get_enum()
renderer_globals['six'] = six
renderer_globals['json'] = json