Re: magic-removal - count with a condition

2006-04-04 Thread Istvan

great, thanks for the tip


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



Re: magic-removal - count with a condition

2006-04-04 Thread Max Battcher

Istvan wrote:
> In Django 0.91 the
> 
> foos.get_count( complex=condition )
> 
> was a valid construct. The magic removal branch raises an exception:
> "count() takes exactly 1 argument (2 given)" when doing a :
> 
> foo.objects.count( condition )
> 
> Is that intended? What would be a workaround?

foo.objects.exclude(somecondition).filter(othercondition).count()

The lazyness of the new QuerySets means that the above simply creates a 
COUNT query, no matter how many exclude()s and filter()s you might combine.

-- 
--Max Battcher--
http://www.worldmaker.net/
"I'm gonna win, trust in me / I have come to save this world / and in 
the end I'll get the grrrl!" --Machinae Supremacy, Hero (Promo Track)

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



magic-removal - count with a condition

2006-04-04 Thread Istvan

In Django 0.91 the

foos.get_count( complex=condition )

was a valid construct. The magic removal branch raises an exception:
"count() takes exactly 1 argument (2 given)" when doing a :

foo.objects.count( condition )

Is that intended? What would be a workaround?

i.


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