duh, i forgot to say that i had 477 registered domain in the database
and 0 hosts before i run this code :-)
On 7 Mai, 15:40, Riccardo Pelizzi wrote:
> Sorry for the delay. hosts__isnull works!
> But i can confirm exclude doesn't:
>
> h = Host.objects.create(ip="0.0.0.0")
> d = RegisteredDomain.
Sorry for the delay. hosts__isnull works!
But i can confirm exclude doesn't:
h = Host.objects.create(ip="0.0.0.0")
d = RegisteredDomain.objects.all()[0]
d.hosts.add(h)
RegisteredDomain.objects.count()
--> 477L (total)
RegisteredDomain.objects.filter(hosts=None).count()
--> 476L (good!)
Registered
On Mon, 2009-05-04 at 09:18 -0700, Riccardo Pelizzi wrote:
> Hello,
>
> I have a model which looks kinda like this:
>
> class Host(model):
> ip = IPAddressField()
>
> class Domain(model):
> hosts = ManyToManyField(Host)
>
> If i want to get all the domains without hosts:
> Domain.objects.f
3 matches
Mail list logo