Thanks for the fast replies ! > So - what you were trying to do was combine the `month` and `gt` > operators - you can't do that. Django interpreted your query as 'join > the Contact with the naissance table, and check that the month > attribute is greater than 5'. Obviously, this doens't work because > naissance isn't a table - it's a date field on the Contact model. > Instead, you need to find a single operator that will do what you > want. Without knowing exactly what you want to do, I'm guessing that > __range is probably the best option.
I want to find all the contacts whose anniversary is between today and datelim=today+30 days. The problem is that I don't have a table with anniversaries dates, I only have birth dates. So I cannot use directly the range operator like anniv = Contact.objects.filter(naissance__range=(today, datelim)) because the year numbers will not fit - unless this contact is only a few months old. So I think I only have three options now : 1) change my model and replace the naissance field with three fields corresponding to birth day, birth month and birth year. 2 ) change my model and add an anniversary field. This would allow me to use directly the range operator. But on the other hand, I will have to update regularly theses field. 3 ) keep my model as it is and do all the search in pure python. Do I miss something ? As I'm interested in learning django, I would rather go for the first one. What's the best way to change my model and to minimize the operation on my database ? Is-there a way to migrate easily my data ? Regards, --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---