Re: Filtering by month doesn't work

2013-11-29 Thread Joseph Mutumi
I think the model is not being saved because no instance is being constructed by the form. Either make call to event_form.is_valid() of event_form.full_clean(), the former being preferred. On Tue, Nov 26, 2013 at 8:30 PM, Leonardo Giordani < giordani.leona...@gmail.com> wrote: > Are you sure tha

Re: Filtering by month doesn't work

2013-11-26 Thread Leonardo Giordani
Are you sure that filtering using a string is the same as filtering using an int? I think that Django doesn't automatically convert it. So the condition events = Event.objects.filter(end__month='11') should be events = Event.objects.filter(end__month=11) Indeed documentation

Re: Filtering by month doesn't work

2013-11-26 Thread Vojtěch Tranta
from django.db import models from django.contrib.auth.models import User from student import Student from eventtype import EventType from django import forms import datetime class Event(models.Model): user = models.ForeignKey(User) student = models.ForeignKey(Student) place = models.CharField(max_

Re: Filtering by month doesn't work

2013-11-26 Thread Vojtěch Tranta
I am no using that condition, I am absolutely sure that I have november dates in my DB (i am using MySQL). I tried everything in terms of using datetime to compare db month with, no luck so far Dne úterý, 26. listopadu 2013 3:54:09 UTC+1 Начаров Михаил napsal(a): > > Hi Tranta. > In my projec

Re: Filtering by month doesn't work

2013-11-25 Thread Leonardo Giordani
May you please post your Event model? Leonardo Giordani Author of The Digital Cat My profile on About.me - My GitHub page- My Coderwall profile 2013/11/26 Начаров Мих

Re: Filtering by month doesn't work

2013-11-25 Thread Начаров Михаил
Hi Tranta. In my projects this functionality works fine. What version of django did you used? Do you sure that field end in Event table contains November dates? Also, you can use *today.month* instead of *int(today.strftime('%m')*) and* today.year *instead of *int(today.strftime('%Y')).* And

Filtering by month doesn't work

2013-11-25 Thread Vojtěch Tranta
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.object