Hi Jacob,

I've just updated to revision 3654.

I was trying to populate a context with two different lists of news
entries. The second list shouldn't display entries already shown in the
first, so I used exclude with 'id__in' to separate the results.

Also, I'm using a custom manager to show only public entries.

The problem appeared when the first list was empty, the second list
filter gives an error.

Here is the relevant code:

def home(request):
    # Initialize the context
    context = []

    # Get 5 hot news
    context['hot_news_list'] = Entry.public.filter(hot=True)[:5]

    # Get the hot news IDs to ignore in the next queries
    ids = [entry.id for entry in context['hot_news_list']]

    # Get 4 simple news
    context['simple_news_list'] = Entry.public.exclude(id__in=ids)[:4]
    
    return render_to_response('home.html', context)


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

Reply via email to