from django.shortcuts import render

# Create your views here.

@@ -9,55 +9,1209 @@
 ngo.
-shortcuts import render%0A%0A# Create your views here.
+contrib.auth import get_user_model%0A%0Afrom referrals.models import Referral%0Afrom .serializers import UserSerializer, ReferralSerializer%0A%0Afrom rest_framework import generics%0A%0Aclass UserRetriveAPIView(generics.RetrieveAPIView):%0A    %22%22%22%0A    API endpoint for an user and referrals.%0A    %22%22%22%0A    model = get_user_model()%0A    serializer_class = UserSerializer%0A    lookup_field = 'username'%0A%0A%0Aclass ReferralListCreateAPIView(generics.ListCreateAPIView):%0A    %22%22%22%0A    API endpoint for referrals.%0A    %22%22%22%0A    model = Referral%0A    serializer_class = ReferralSerializer%0A%0A    def pre_save(self, obj):%0A        obj.user = self.request.user%0A%0A%0Aclass ReferralRetreveUpdateAPIView(generics.RetrieveUpdateAPIView):%0A    %22%22%22%0A    API endpoint for retreving and updating a referral. Referral unique id i.e slug should be%0A    provided.%0A    %22%22%22%0A    model = Referral%0A    serializer_class = ReferralSerializer%0A    lookup_field = 'slug'%0A%0A%0Aclass ReferralRetriveUpdateDestroyAPIView(generics.RetrieveUpdateDestroyAPIView):%0A    %22%22%22%0A    API endpoint for retreving and removing a referral. Referral unique id i.e slug should be%0A    provided.%0A    %22%22%22%0A    model = Referral%0A    serializer_class = ReferralSerializer%0A    lookup_field = 'slug'%0A%0A%0A
 %0A

add API views