>
> You can extract this information from the _meta attribute on a model.
> This isn't documented (yet), but it's on the TODO list for things to
> document before 1.0.
>
thanks, i will check out this _meta attribute.
it seems to me that ManyToManyField is not a field, it is a table. so
if we did
On Sun, 2007-02-18 at 21:36 +, akonsu wrote:
> thanks.
>
> this is good enough, although in general having to fall back to sql is
> not portable between different database engines.
It usually is possible, providing you get the table and column names
correct (as you indicate below). The main
thanks.
this is good enough, although in general having to fall back to sql is
not portable between different database engines.
i think that at least having methods that return the names of the
underlying database tables and/or fields would be helpful. so that i
could use them in stead of 'myapp
Hi,
I believe you could use
queryset.extra( select={ 'B_count' : 'SELECT COUNT(*) FROM myapp_a_bs
WHERE a_id = myapp_a.id' } )
it will result in a slightly different, but equivalent, query:
SELECT
myapp_a.id,
myapp_a,
...,
( SELECT COUNT(*) FROM myapp_a_bs WHERE a_id = myapp_a.id ) AS "B_
hello,
class A(models.Model):
bs = models.ManyToManyField('B')
class B(models.Model):
how to implement this query:
select *
from myapp_a
inner join (select a_id, count(*)
from myapp_a_bs
group by a_id) as a
on myapp_a.id=a
5 matches
Mail list logo