Monday, November 25, 2013

Filtering by month doesn't work

Hi,
do you have any clue why this does not work?

def index(request):
if request.method == 'POST' and request.POST:
event_form = EventForm(request.POST)
event = event_form.save()

today = datetime.date.today();
year = int(today.strftime('%Y'))
month = int(today.strftime('%m'))
events = Event.objects.filter(end__month='11')
# events = Event.objects.all()
pdb.set_trace()
cal = jvccalendar.HTMLCalendar(jvccalendar.MONDAY).formatmonth(year, month, events)
form = EventForm()
return render_to_response('jvc/index.html', {'cal': cal, 'side_form': form}, context_instance=RequestContext(request))

I am still getting "events" as empty, filtering using filter(end_start='2013') works, but filtering by month does not, I googled as much as I could, but no luck. I copied code from StackOverflow, but no luck.... 
Thank you!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a4f92f8f-710d-4a19-b869-3a93681557fc%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment