hello,
the code below generates two queries to the database. is there a way
to make it get all objects related to object 'aa' and then just look
up the right one when get() is called?
thanks
konstantin
class AA(models.Model) :
name = models.SlugField()
class BB(models.Model) :
name = models.SlugField()
class AB(models.Model) :
aa = models.ForeignKey(AA)
bb = models.ForeignKey(BB)
r = AB.objects.select_related().filter(aa__name = 'aa')
l = list(r) # this evaluates 'r' but the statements below hit the
database anyway...
print r.get(bb__name = 'bb1')
print r.get(bb__name = 'bb2')
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---