Adding context_instance=RequestContext(request) to the method fixed
the problem. Seems this should be done by default for
render_to_response method. Thank you.


On Oct 20, 4:36 am, Christian Joergensen <[EMAIL PROTECTED]> wrote:
> Chuck Bai2 wrote:
> > Here is my view code:
>
> > def contact(request):
> >     form = ContactForm() # An unbound form
> >     return render_to_response('contact.html', {
> >         'form': form,
> >     })
> > My contact form page rendered but without all the media files(CSS files,
> > Javascripts files, images). The text part of the page is OK and I can
> > see my contact form displayed OK.
> > If I left the form out, just render the page using direct_to_template
> > like below, the page is working fine. All the media files are rendered.
>
> > def contact(request):
> >     return direct_to_template(request, template='contact.html')
>
> These views doesn't have anything to do with serving media. Check the
> two outputs if the media paths are correct.
>
> You are probably missing the context_instance argument for
> render_to_response to have context processors activated and get any
> context processor generated extra context variables available in your
> template.
>
> Use the RequestContext as a base context when using render_to_response:
>
>    return render_to_response('contact.html', {
>        'form': form,
>    }, context_instance=RequestContext(request))
>
> Regards,
>
> --
> Christian Joergensenhttp://www.technobabble.dk
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to