I want to make my current more interactive by having ajax that calls for json data, I haven't done anything yet except for research and studying. Here are some things I am not very clear. If JsonResponse and DRF can give the json data i need how is DRF different from JsonResponse ?
Django Rest Framework includes a lot of tools that JsonResponse doesn't have.
JsonResponse is to Django Rest Framework as Flask is to Django. You can do all the things you want with JsonResponse, but DRF gives you a lot of tools to automate many tasks, where JsonResponse would require you to manually do all those things.
Edit to clarify: DRF somewhat mirrors Django's functionality. For instance, to validate data, you can do this in the serializer class in DRF, much like you would validate data in the form class in base Django. You can automagically create serializers from models in DRF by using ModelSerializer classes, which is much like Django's generic views.
On the home page of DRF, the very top explains much of what DRF does, including links to examples and explanations:
Django Rest Framework
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With