I am adding a variable to a dictionary like this:
rr_context["start_date"] = c.start_date
And then I pass the dictionary to render_to_response:
return render_to_response(
rr_template,
rr_context,
context_instance=RequestContext(request))
Then in template I try to format it this way:
{{ start_date|date:"F" }}
But it returns nothing. I found the problem is for some reason Django passes a variable looking like this: (datetime.date(2011, 10, 7),). I don’t know why it happens this way.
I read the docs and I think I did it right way. What can be the issue?
It seems that your
start_dateis a tuple and not a single date value. That’s why thedatefilter doesn’t work.You should check that
c.start_dateis a date, because it looks like it’s a tuple.