-
Notifications
You must be signed in to change notification settings - Fork 32
Keremserttas hw4 #106
base: main
Are you sure you want to change the base?
Keremserttas hw4 #106
Conversation
@@ -15,6 +22,11 @@ class BasketItemViewSet(DetailedViewSetMixin, viewsets.ModelViewSet): | |||
"detailed": BasketItemDetailedSerializer, | |||
} | |||
|
|||
def get_queryset(self): | |||
queryset = super().get_queryset() | |||
user = self.request.user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
login olmamis bir kullanici durumunda problem olusuyor sanki?
|
||
def get_queryset(self): | ||
queryset = super().get_queryset() | ||
user = self.request.user |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
login olmamis bir kullanici durumunda problem olusuyor sanki?
basket_item.quantity += quantity | ||
|
||
else: | ||
basket_item = BasketItem.objects.create(basket=basket, product=product, quantity=quantity,price=price) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kayit insert/update validation islemlerini serializer uzerinden yapmamizda fayda var.
basket_item.save() | ||
basket.save() | ||
|
||
serializer = BasketItemSerializer(basket) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
basket viewseti basket e ait bir serializer datasi donmesi daha iyi bir fikir olur.
Register Endpoint added, DRF action is added for adding net basketItem to basket. Viewsets are updated regarding their permissions.