from rest_framework import viewsets
from rest_framework_extensions import mixins

from imagefy.profile.models import Profile
from imagefy.wishes.models import Offer, Wish
from imagefy.wishes.serializers import OfferSerializer, WishSerializer


class WishViewSet(mixins.NestedViewSetMixin, viewsets.ModelViewSet):
    queryset = Wish.objects.all()
    serializer_class = WishSerializer

    def get_queryset(self):
        qs = super().get_queryset()

        if self.request.user.profile.type == Profile.SALESMAN:
            return qs

        return qs.filter(owner=self.request.user)

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


class OfferViewSet(mixins.NestedViewSetMixin, viewsets.ModelViewSet):
    queryset = Offer.objects.all()
    serializer_class = OfferSerializer

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

@@ -32,53 +32,8 @@
 sets
-%0Afrom rest_framework_extensions import mixins
 %0A%0Afr
@@ -214,35 +214,8 @@
 Set(
-mixins.NestedViewSetMixin, 
 view
@@ -625,35 +625,8 @@
 Set(
-mixins.NestedViewSetMixin, 
 view

remove referencias a lib não usada