On Tue, 2007-05-29 at 05:20 +0000, Michael Newman wrote:
> Something that has been bothering me for awhile and I finally just
> decided to post it here because my code work around hits the database
> way too many times.
> 
> I am writing a custom view for an application that uses multiple
> categories per story. So I want to lookup stories so that they aren't
> duplicates and they don't appear in a category that is displayed
> before. So
> 
> breakingnews =
> Story.objects.all.filter(category__name__exact="breakingnews")
> news = Story.Objects.all.exclude(ids = breakingnews.ids)
> 
> Now I realize that I could just exclude the filter, so:
> news = Story.Objects.all.exclude(category__name__exact="breakingnews")

Well, at some point you have to specify which objects to exclude. What
other way could there be to do it other than giving the query
specifiers?

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to