Re: loader.select_template breaks template name
Thanks, that solved the problem.
On a side note this means there is a bug in the Django documentations
as this was the example they were giving :
get_template('story_detail.html') (at https://docs.djangoproject.com/en/dev/ref/templates/api/)
I will open a ticket about this
On Apr 8, 9:01 am, Russell Keith-Magee <russ...@keith-magee.com>
wrote:
> Hi,
>
> loader.select_template() is expecting a list of values, and you're providing a single value. However, Django interprets a string as a list of strings (each one character long), so it doesn't raise an error due to the type of the data; it only raises an error because the single-letter filename can't be found.
>
> Make a call to loader.select_template(['test.html']), and everything should work as expected.
>
> Yours,
> Russ Magee %-)
>
>
>
>
>
>
>
> On Sunday, 8 April 2012 at 4:01 AM, gnesher wrote:
> > Hi,
>
> > I'm receiving some odd results while playing with select_template
> > (Django 1.4)
>
> > I'm calling the following code in my view:
> > loader.select_template('test.html')
>
> > Which results in the following error:
>
> > TemplateDoesNotExist at /test
> > t, e, s, ., h, m, l
>
> > Can't really figure out what I'm doing wrong as this should be rather
> > straightforward.
>
> > Thanks
>
> > --
> > You received this message because you are subscribed to the Google Groups "Django users" group.
> > To post to this group, send email to django-users@googlegroups.com (mailto:django-users@googlegroups.com).
> > To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com (mailto:django-users+unsubscribe@googlegroups.com).
> > For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home