form = newform() # An unbound form
>
>return render_to_response('index.html', {
>'form': form,
>},context_instance=RequestContext(request))
>
>
>
> but everytime i add the context_instance=RequestContext(req
form = newform() # An unbound form
>
>return render_to_response('index.html', {
>'form': form,
>},context_instance=RequestContext(request))
>
>
>
> but everytime i add the context_instance=RequestContext(req
p = newsletter(question = "" +
str(request.POST.get('question')) , email = "" +
str(request.POST.get('email')))
p.save()
else:
form = newform() # An unbound form
return render_to_response('index.html', {
>> > ... I'm hoping some standard solution
>> > already exists.) Sorry to be so long winded.
Hi there,
in older Django versions, you can use direct_to_template from
generic views to automatically use RequestContext. I'm using it to
save a line or two per view. Not a magic solution, but might
static files from templates, you write something like
> > {{ STATIC_URL }}css/mystyle.css. For STATIC_URL to be bound to the
> > value assigned in settings.py, it is apparently necessary to include
> > "context_instance = RequestContext(request)" when you render the
> > t
necessary to include
> "context_instance = RequestContext(request)" when you render the
> template. And you have to do this even if you don't need the
> RequestContext for CSRF protection or any other reason. In effect,
> that means you have to include the RequestConte
tance = RequestContext(request)" when you render the
template. And you have to do this even if you don't need the
RequestContext for CSRF protection or any other reason. In effect,
that means you have to include the RequestContext *every* time you
render a template (assuming every template contains
7 matches
Mail list logo