﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
30458	Allow JsonResponse to automatically serialize JSON responses	dopatraman	nobody	"I find the JsonResponse interface to be a bit clunky. I'd like to be able to do something like this:
```
# models.py
class BaseModel(models.Model):
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)

    class Meta:
        abstract = True


class User(AbstractUser):
    username = models.CharField(max_length=255, unique=True)
    email = models.EmailField(unique=True, null=False)
    created_at = models.DateTimeField(auto_now_add=True)
    updated_at = models.DateTimeField(auto_now=True)


class Post(BaseModel):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    content_url = models.URLField(null=False)

#############

# views.py
def get_all_posts(request):
    return JsonResponse({""posts"": list(Post.objects.all())})

return JsonResponse({""posts"": list(Post.objects.all())})
```

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)

Can we improve `JsonResponse` so that it automatically serializes responses?"	New feature	new	HTTP handling	2.2	Normal		json		Unreviewed	0	0	0	0	0	0
