Changes between Initial Version and Version 1 of Ticket #30458
- Timestamp:
- May 7, 2019, 11:56:52 AM (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #30458 – Description
initial v1 1 1 I find the JsonResponse interface to be a bit clunky. I'd like to be able to do something like this: 2 ``` 2 {{{ 3 3 # models.py 4 4 class BaseModel(models.Model): … … 28 28 29 29 return JsonResponse({"posts": list(Post.objects.all())}) 30 ``` 30 }}} 31 31 32 32 But this produces a JSON serialization error. The "proper" way is apparently to serialize and deserialize the object manually, which in itself is not adequate because the process separates the values of the model instance from its primary key (detailed here: https://stackoverflow.com/questions/56012024/why-doesnt-jsonresponse-automatically-serialize-my-django-model/56016542#56016542)