Permalink
Browse files

Include widget_template to list of possible templates only when not N…

…one.
  • Loading branch information...
glogiotatidis committed Mar 25, 2013
1 parent ca57820 commit 11f827da0defedeab709ef5c8508082f8f6ff647
Showing with 10 additions and 4 deletions.
  1. +1 −0 AUTHORS
  2. +3 −0 CHANGELOG
  3. +6 −4 autocomplete_light/widgets.py
View
@@ -6,6 +6,7 @@ list.
- Fábio C. Barrionuevo da Luz
- Marc Hörsken
- Tyler Kellogg
+- Giorgos Logiotatidis
- Andreas Madsack
- Riccardo Magliocchetti
- Simone Marcarino
View
@@ -1,3 +1,6 @@
+1.1.26
+- Fixed #114: Use widget_template attr only when set.
+
1.1.25 Fixed #108: generic inline support.
1.1.24
@@ -108,14 +108,16 @@ def render(self, name, value, attrs=None):
'autocomplete': autocomplete,
}
context.update(self.extra_context)
-
- return safestring.mark_safe(render_to_string([
- getattr(autocomplete, 'widget_template', ''),
+ templates = [
'autocomplete_light/%s/widget.html' % autocomplete_name,
'autocomplete_light/%s/widget.html' % getattr(autocomplete,
'widget_template_name', ''),
'autocomplete_light/widget.html',
- ], context))
+ ]
+ widget_template = getattr(autocomplete, 'widget_template', None)
+ if widget_template:
+ templates.insert(0, widget_template)
+ return safestring.mark_safe(render_to_string(templates, context))
class ChoiceWidget(WidgetBase, forms.Select):

0 comments on commit 11f827d

Please sign in to comment.