You can use the serializers class as follows:
from django.core import serializers query_agao = ButuanMaps.objects.all().select_related('landproperty')[:10] json_serialized_objects = serializers.serialize("json", query_agao)
If you want to serialize multiple fields, do the following:
json_serialized_objects = serializers.serialize("json", query_agao, fields=("fieldname1", "fieldname2"))
where fieldname1 and fieldname2 are attributes of the landproperty model class.
Alternatively, you can write your own serializer for your landproperty class and use it when rendering is called.
source share