From 437157440308179ef6171fc26155fad2876b5a72 Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Sun, 9 Aug 2020 14:03:28 -0500 Subject: [PATCH] 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 --- tailbone/helpers.py | 1 + tailbone/subscribers.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tailbone/helpers.py b/tailbone/helpers.py index 3a3d8365..46a30dec 100644 --- a/tailbone/helpers.py +++ b/tailbone/helpers.py @@ -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 * diff --git a/tailbone/subscribers.py b/tailbone/subscribers.py index 90930e60..af88f7a7 100644 --- a/tailbone/subscribers.py +++ b/tailbone/subscribers.py @@ -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