Permalink
Browse files

Fixed passing template names as strings

  • Loading branch information...
1 parent c4df75f commit 7a7ca446c7433b589cab93ef720c251b4dbedde0 @bfirsh committed Sep 12, 2010
Showing with 3 additions and 1 deletion.
  1. +2 −0 class_based_views/base.py
  2. +1 −1 class_based_views/tests/tests/base.py
@@ -102,6 +102,8 @@ def get_template(self, names=None):
if not names:
raise ImproperlyConfigured("'%s' must provide template_name."
% self.__class__.__name__)
+ if isinstance(names, basestring):
+ names = [names]
return self.load_template(names)
def get_template_names(self):
@@ -115,7 +115,7 @@ def test_get(self):
"""
self._assert_about(AboutTemplateView()(self.rf.get('/about/')))
- def test_get(self):
+ def test_get_template_attribute(self):
"""
Test a view that renders a template on GET with the template name as
an attribute on the class.

0 comments on commit 7a7ca44

Please sign in to comment.