import status in django rest framework

# Step 1: Import the necessary module
from rest_framework import status

# Step 2: Use the imported status codes in your Django Rest Framework views or serializers

# Example in a Django Rest Framework view
from rest_framework.views import APIView
from rest_framework.response import Response

class MyApiView(APIView):
    def get(self, request):
        # Step 3: Use the imported status codes in your view logic
        data = {"message": "Success"}
        return Response(data, status=status.HTTP_200_OK)

# Example in a Django Rest Framework serializer
from rest_framework import serializers

class MyModelSerializer(serializers.Serializer):
    # ... serializer fields definition ...

    def create(self, validated_data):
        # Step 4: Use the imported status codes in your serializer logic
        # ... create object logic ...
        return instance, status.HTTP_201_CREATED