Re: render_to_response syntax
Absolutely right - 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: render_to_response syntax
On Sun, Mar 30, 2008 at 5:23 AM, Jaap <[EMAIL PROTECTED]> wrote: > > render_to_response('template', *args, **kwargs): > kwargs looks like a dictionary but if I refer to a dictionary, it is > ignored: > > In >names = {} >names['my_name'] = "somename" >render_to_response('template.html', names) > > names is equivalent to {'my_name': 'somename'}, so I would expect the > render_to_response to work - but it doesn't: why? > I'm guessing (since you don't give any details of how "doesn't work" manifests itself) that the problem is not the dictionary you pass to render_to_response, but rather that you are throwing away the return value of render_to_response. It returns an HttpResposne, which is what your view function needs to return. Assuming that last line is the last line of your view function, it should be: names = {} names['my_name'] = "somename" return render_to_response('template.html', names) Karen --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
Re: render_to_response syntax
> render_to_response('template', *args, **kwargs): > kwargs looks like a dictionary but if I refer to a dictionary, it is > ignored: > > In >names = {} >names['my_name'] = "somename" >render_to_response('template.html', names) > > names is equivalent to {'my_name': 'somename'}, so I would expect the > render_to_response to work - but it doesn't: why? http://en.wikipedia.org/wiki/Varargs#Variadic_functions_in_Python --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---
render_to_response syntax
render_to_response('template', *args, **kwargs): kwargs looks like a dictionary but if I refer to a dictionary, it is ignored: In names = {} names['my_name'] = "somename" render_to_response('template.html', names) names is equivalent to {'my_name': 'somename'}, so I would expect the render_to_response to work - but it doesn't: why? --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~--~~~~--~~--~--~---