Re: Comparing dates..

2007-06-20 Thread Ramashish Baranwal
On Jun 20, 4:36 am, oggie rob <[EMAIL PROTECTED]> wrote: > I could be a bit more pythonic: > > >>> from django.db.models.query import QOr > >>> ql = [Q(birthdate__day=(startdate + timedelta(days=x)).day) & > >>> Q(birthdate__month=(startdate + timedelta(days=x)).month) for x in > >>> range(7)] >

Re: Comparing dates..

2007-06-19 Thread oggie rob
I could be a bit more pythonic: >>> from django.db.models.query import QOr >>> ql = [Q(birthdate__day=(startdate + timedelta(days=x)).day) & >>> Q(birthdate__month=(startdate + timedelta(days=x)).month) for x in range(7)] >>> Person.objects.filter(QOr(*ql)) -rob On Jun 19, 2:51 pm, Tim Chase <

Re: Comparing dates..

2007-06-19 Thread Tim Chase
> I want to compare dates in my db while ignoring the year field. Lets > say I have a birthday field and want to find upcoming birthdays in the > next one week. How can I achieve this? If I try- > > last_date = datetime.now().date() + timedelta(days=7) > users = User.objects.filter(birthday__day_

Comparing dates..

2007-06-19 Thread Ramashish Baranwal
Hi, I want to compare dates in my db while ignoring the year field. Lets say I have a birthday field and want to find upcoming birthdays in the next one week. How can I achieve this? If I try- last_date = datetime.now().date() + timedelta(days=7) users = User.objects.filter(birthday__day__lte =

Re: Comparing dates

2007-04-26 Thread Tim Chase
> today = datetime.date.today() > context[self.varname] = GpUser.objects.filter(birthday=today) > > The problem is, that will never evaluate to true, because I still have > today's year. So, how does one throw out the year and just compare > month and day? Well, the Django ORM handles something

Comparing dates

2007-04-26 Thread [EMAIL PROTECTED]
This is probably more of a python question, but here goes. I want to compare today's date to the users' birthdays and build a list of birthdays. I have the birthdays in the db, properly formatted, and have a template tag with this: today = datetime.date.today() context[self.varname] = GpUser.obje