from leads.models import Lead , Task
from rest_framework import viewsets , permissions
from .serializers import LeadSerializer , TaskSerializer

class LeadViewSet(viewsets.ModelViewSet):
    
    permission_classes = [
        permissions.IsAuthenticated,
    ]
    
    serializer_class = LeadSerializer
    
    def get_queryset(self):
        return self.request.user.leads.all()

    def  perform_create(self , serializer):
        serializer.save(owner = self.request.user)



class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [
        permissions.AllowAny
    ]
    serializer_class = TaskSerializer
 
74e34b50b6f64ca4c7aa6c523cc7df623242608f
<mask token>


class LeadViewSet(viewsets.ModelViewSet):
    <mask token>
    <mask token>
    <mask token>
    <mask token>


class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [permissions.AllowAny]
    serializer_class = TaskSerializer

<mask token>


class LeadViewSet(viewsets.ModelViewSet):
    <mask token>
    <mask token>
    <mask token>

    def perform_create(self, serializer):
        serializer.save(owner=self.request.user)


class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [permissions.AllowAny]
    serializer_class = TaskSerializer

<mask token>


class LeadViewSet(viewsets.ModelViewSet):
    <mask token>
    <mask token>

    def get_queryset(self):
        return self.request.user.leads.all()

    def perform_create(self, serializer):
        serializer.save(owner=self.request.user)


class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [permissions.AllowAny]
    serializer_class = TaskSerializer

<mask token>


class LeadViewSet(viewsets.ModelViewSet):
    permission_classes = [permissions.IsAuthenticated]
    serializer_class = LeadSerializer

    def get_queryset(self):
        return self.request.user.leads.all()

    def perform_create(self, serializer):
        serializer.save(owner=self.request.user)


class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [permissions.AllowAny]
    serializer_class = TaskSerializer

from leads.models import Lead , Task
from rest_framework import viewsets , permissions
from .serializers import LeadSerializer , TaskSerializer

class LeadViewSet(viewsets.ModelViewSet):
    
    permission_classes = [
        permissions.IsAuthenticated,
    ]
    
    serializer_class = LeadSerializer
    
    def get_queryset(self):
        return self.request.user.leads.all()

    def  perform_create(self , serializer):
        serializer.save(owner = self.request.user)



class TaskViewSet(viewsets.ModelViewSet):
    queryset = Task.objects.all()
    permission_classes = [
        permissions.AllowAny
    ]
    serializer_class = TaskSerializer
 