Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread mattimust...@gmail.com
On Dec 28, 10:01 am, "Russell Keith-Magee" wrote: > On Sun, Dec 28, 2008 at 5:32 AM, adambossy wrote: > > > Russ, > > > Thanks for the reply. Specifically, I am wondering if there is some > > feature of the Models API that allows me to retrieve the foreign key > > object so that it is included

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread Russell Keith-Magee
On Sun, Dec 28, 2008 at 5:32 AM, adambossy wrote: > > Russ, > > Thanks for the reply. Specifically, I am wondering if there is some > feature of the Models API that allows me to retrieve the foreign key > object so that it is included in the serialized string. That is, > without writing my own se

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread adambossy
Russ, Thanks for the reply. Specifically, I am wondering if there is some feature of the Models API that allows me to retrieve the foreign key object so that it is included in the serialized string. That is, without writing my own serializer (which I suspect I may have to do). Alternatively, I wa

Re: How do I make Django evaluate a ForeignKey for json serialization?

2008-12-27 Thread Russell Keith-Magee
On Sat, Dec 27, 2008 at 2:11 PM, adambossy wrote: > > I have a model that refers to a ForeignKey, e.g.: > > class Template(models.Model): > type = models.ForeignKey(Type) > ... > > class Type(models.Model) > name = models.CharField(max_length=32) > ... > > I can fetch these objects fine using t

How do I make Django evaluate a ForeignKey for json serialization?

2008-12-26 Thread adambossy
I have a model that refers to a ForeignKey, e.g.: class Template(models.Model): type = models.ForeignKey(Type) ... class Type(models.Model) name = models.CharField(max_length=32) ... I can fetch these objects fine using the model API. t = Template.objects.get(id=1) print t.type >> print t