models.py
HashMap
views.py
class City(models.Model):
name = models.CharField(max_length=50, null=True)
state = models.CharField(max_length=2, null=True)
def fooFunc(self):
return 'foo'
foo = property(fooFunc)
我的views.py中发生的事情只返回'名称'并且'州' json响应中的字段。如何让它包含def getCities(request):
json = serialize('geojson', City.objects.all(), fields=('name', 'state', 'foo'))
response = HttpResponse(json)
return response
或方法foo
的响应?