Skip to content

Commit

Permalink
FIX: Dependency bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jsmorenoh committed Jun 28, 2021
1 parent 94ea9fd commit 97351a6
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions apps/finances/views/credit_cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,22 @@ class CreditCardViewSet(
):
""" Credit card query views set"""

serializer_class = CreditCardModelSerializer
def get_serializer_class(self):
import ipdb

ipdb.set_trace()
try:
self.request.user
except:
pass
if self.request.user.is_superuser:
return CreditCardSuperUserModelSerializer
return CreditCardModelSerializer

def get_queryset(self):
if self.request.user.is_superuser:
return CreditCard.objects.all()
return CreditCard.objects.filter(user=self.request.user)

def get_serializer_class(self):
if self.request.user.is_superuser:
return CreditCardSuperUserModelSerializer
return CreditCardModelSerializer

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

0 comments on commit 97351a6

Please sign in to comment.