Consider the following Django Model:
class Event(models.Model):
startDate = models.DateField()
endDate = models.DateField()
user = models.ForeignKey(User, null=True)
Later in my view I do this:
django.core.serializers.serialize("json", Event.objects.all())
return HttpResponse(data, mimetype='application/javascript')
And get the following response:
[
{
"pk": 1,
"model": "myapp.event",
"fields": {
"startDate": "2010-02-02",
"endDate": "2010-02-02",
"user": 2
}
}
]
Is it possible for to get the serializer to 'go deeper' and serialize the User that is referenced by the Event instance so I can access that data in my Javascript code?
It seems as if this is possible using the development version, but I'm using 1.1 FWIW.