From ae76035bc7fe939996dfff4e8fc8777c5686e60b Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 10 Jul 2018 16:49:03 +0200 Subject: Search widget: dynamic link for bookmark save --- ishtar_common/widgets.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ishtar_common/widgets.py') diff --git a/ishtar_common/widgets.py b/ishtar_common/widgets.py index 8788920af..405b5d69e 100644 --- a/ishtar_common/widgets.py +++ b/ishtar_common/widgets.py @@ -479,6 +479,17 @@ if settings.SURFACE_UNIT == 'square-metre': class SearchWidget(forms.TextInput): template_name = 'widgets/search_input.html' + def __init__(self, app_name=None, model=None, attrs=None): + super(SearchWidget, self).__init__(attrs) + self.app_name = app_name + self.model = model + + def get_context(self, name, value, attrs): + context = super(SearchWidget, self).get_context(name, value, attrs) + context['app_name'] = self.app_name + context['model'] = self.model + return context + class ModelFieldMixin(object): def to_python(self, value): -- cgit v1.2.3