I am using django-rest-framework for api for my webapp. Is it good to use django rest framework in place of default ORM provided by django? I have refered to this post and still confused. As drf-api requires classes to be created and I think its better to use that code for handling objects since I can reuse code.
urls.py
router = routers.DefaultRouter()
router.register(r'users', views.UserViewSet)
views.py
class UserViewSet(viewsets.ModelViewSet):
"""
API endpoint that allows users to be viewed or edited.
"""
queryset = User.objects.all()
serializer_class = UserSerializer
serializers.py
class UserSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = User
fields = ('url', 'username', 'email', 'groups')
How can I handle objects the crud way in views.py using django rest framework?
drfinstead ofdjango orm? I have updated this question. Can you please refer to the link in updated question?