diff options
Diffstat (limited to 'ishtar_common/widgets.py')
-rw-r--r-- | ishtar_common/widgets.py | 11 |
1 files changed, 11 insertions, 0 deletions
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): |