Hi,

My ModelX is:

user = models.ForeignKey(User)
place = models.ForeignKey(Place)
date = models.DateTimeField()
taken = models.BooleanField()

Now I need to fetch all the ModelX records via Place
object.modelx_set.all
but I only want to fetch records with date now/in the future.

This would be:
object.modelx_set.filter(date__gte=datetime.date.today()).count

I cannot override the default manager get_query_set as I need to see
all the records in admin f.e.

The problem is that I mostly use Generic views, and fetching objects
via _set. is
the only acceptable solution.

I know this might be done with custom ModelX model manager.
Can anyone point me to the right direction ?

I've read:
http://www.djangoproject.com/documentation/models/custom_managers/
but it's just a typical example and I don't know how to use it with
_set method.

Also, I read sources, but they are too complicated for me at this point
of my python
knowledge.

Thanks,
Robert


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to