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)]
>
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 <
> 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_
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 =
> 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
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
6 matches
Mail list logo