Its hard to tell what you mean by "really long once I start factoring time and uniqueness". Do you mean really large data sets or really wide lines in your python file? If the former, you will probably need to be more specific about what the long query contains. If the latter, look at chaining query sets.
BTW you don't need to use "all" if have any other function (exclude, filter, count etc). so Story.objects.exclude(xxx=yyy) would be fine -rob On May 28, 10:20 pm, Michael Newman <[EMAIL PROTECTED]> 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") > > but this gets really long once I start factoring time and uniqueness. > Is there an easy way to filter objs like that? > > Thanks in advance, Mn --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---