[Answer]-Python Django json serialise

1đź‘Ť

âś…

Serialization is used for serializing/unserializing of models. Django is unable to unserialize model without this “model” field.

Why you use serialization at all? Why not use standard json library?

import json
from getdata.models import record_search

query_data = record_search.objects.filter(**filter_kwargs) \
                          .values("id", "domain", "record", "record_points_to",
                                  "priority_mx", "ttl", "generated_on")
data = json.dumps(list(query_data))
👤catavaran

Leave a comment