Hi,
This should be a simple question but I just couldn't seem to find
the answer. I have a simple 2 model relationship:
class B(models.Model):
bfield = models.CharField(...)
class A(models.Model):
afield = models.CharField(...)
modelB = models.ForeignKey(B)
what is the best way to query for example A.objects.filter(pk=1) such
that the representation is something like:
[{'id':1, 'afield':'a', 'bfield':'b'}]
and not:
[{'id':1, 'afield':'a', 'bfield_id':2}] # eg. using .values()
the objective is to serialize it (if it makes a difference), but the
key idea is to have the output fields represented as if B were never a
separate model.
thank you so much,
Johnny
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---