On Monday 22 June 2009 08:06:25 am Vlad(L) wrote: > Mike, I work on Django 1.0.2 - in this version in settings.py is not > mentioned at all about Media context processor and RequestContext. To > me they need to be added in addition most???
It's not mentioned in the settings.py file, but that's why django has great documentation available for it. See the link I posted before on how to use the context processors. If you scroll up a little bit, the same page will show you how to use the RequestContext class to your benefit. In my case I use the render_to_response shortcut in my views and pass the context_instance variable set as such: context_instance=RequestContext(request) Full use is sample from views.py from sample.models import News from django.template import RequestContext def index(request): qs = News.objects.all()[:5] return render_to_response('index.html', {'items': qs}, context_instance=RequestContext(request) ) Doing so, django will apply the context processors to your request object, adding the contexts for use in your views. I'm going to make a small suggestion, while the books are a great resource, they should be used in addition to the actual documentation available, not instead of. Mike. -- A sense of humor keen enough to show a man his own absurdities will keep him from the commission of all sins, or nearly all, save those that are worth committing. -- Samuel Butler
signature.asc
Description: This is a digitally signed message part.