Hola,

I have a model Person with a dob = models.DateField()

I would like to filter by age - in particular only include people less than
60 years old.

I am having no luck getting the syntax right and was looking for pointers?

          queryset=Person.objects.filter(dob__year__gte
= datetime.datetime.today().year-61)

gets me an error like: Join on field 'dob' not permitted. Did you misspell
'year' for the lookup type?

RETIRE_Y = datetime.datetime.today().year-61
...
              queryset=Person.objects.filter(dob__gte =
datetime(RETIRE_Y,1,1)))),

gives me errors like: 'module' object is not callable

I don't want to create a new field or function on the Person object that
would calculate "age" everyday...

What am I doing wrong/how can I make it right?

cheers
L.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to