Changes between Initial Version and Version 1 of Ticket #30458


Ignore:
Timestamp:
May 7, 2019, 11:56:52 AM (6 years ago)
Author:
dopatraman
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #30458 – Description

    initial v1  
    11I find the JsonResponse interface to be a bit clunky. I'd like to be able to do something like this:
    2 ```
     2{{{
    33# models.py
    44class BaseModel(models.Model):
     
    2828
    2929return JsonResponse({"posts": list(Post.objects.all())})
    30 ```
     30}}}
    3131
    3232But 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)
Back to Top