Let's add Auth User Model to the Ecommerce API we created using Django and Django REST Framework in this video • Lets Create an Ecommerce API with Django a...
So if you've not seen the previous video, please see it here • Lets Create an Ecommerce API with Django a... before proceeding to watch this video.
We just walk through the Django REST Framework documentation at https://www.django-rest-framework.org... through the tutorial.
STEPS:
Added 'created_by' fields to each of Book and Product models
Imported django.contrib.auth.models.User
Created UserSerializer class in serializers.py
Added 'created_by' field to each of BookSerializer and ProductSerializer.
Fixed bugs
Made 'created_by' in response show User's username
Thank you very much.
If you have any questions, queries or comments, please reply in the comments below. Also Like my video and subscribe if you want to.
Bravo! Build Amazing stuff.