What's the best way excluding a query set from a queryset
I'm writing an inbox view and I want to exclude unseen messages from seen messages.
My code is :

> def render_notifications(request):
> 
> 	   unseen_notices = notification.Notice.objects.filter(recipient=request.user,unseen=True).order_by("-added")
> 	   notices = notification.Notice.objects.filter(recipient=request.user).exclude(id__in = [i.id for i in unseen_notices]).order_by("-added")
> 
> 	   for msg in unseen_notices:
> 		   msg.unseen = False
> 		   msg.save()
> 	
> 	   context = RequestContext(request,{'notices':notices,
> 					  'unseen_notices':unseen_notices})
> 	   return render_to_response('my_notifications.html',context_instance=context)

As you can see I exclude all unseen messages using a for loop which doesn't seem convenient and I'm not sure but does this line cause performance issues ? And lastly is there a way that I can replace this line with something similar to :

> notices = notification.Notice.objects.filter(recipient=request.user).exclude(id__in =unseen_messages)
What's the best way excluding a query set from a queryset
===

I'm writing an inbox view and I want to exclude unseen messages from seen messages.
My code is :

> def render_notifications(request):
> 
> 	   unseen_notices = notification.Notice.objects.filter(recipient=request.user,unseen=True).order_by("-added")
> 	   notices = notification.Notice.objects.filter(recipient=request.user).exclude(id__in = [i.id for i in unseen_notices]).order_by("-added")
> 
> 	   for msg in unseen_notices:
> 		   msg.unseen = False
> 		   msg.save()
> 	
> 	   context = RequestContext(request,{'notices':notices,
> 					  'unseen_notices':unseen_notices})
> 	   return render_to_response('my_notifications.html',context_instance=context)

As you can see I exclude all unseen messages using a for loop which doesn't seem convenient and I'm not sure but does this line cause performance issues ? And lastly is there a way that I can replace this line with something similar to :

> notices = notification.Notice.objects.filter(recipient=request.user).exclude(id__in =unseen_messages)