Skip to content
This repository has been archived by the owner on May 12, 2023. It is now read-only.

Keremserttas hw4 #106

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Keremserttas hw4 #106

wants to merge 4 commits into from

Conversation

Gundwane21
Copy link

Register Endpoint added, DRF action is added for adding net basketItem to basket. Viewsets are updated regarding their permissions.

@@ -15,6 +22,11 @@ class BasketItemViewSet(DetailedViewSetMixin, viewsets.ModelViewSet):
"detailed": BasketItemDetailedSerializer,
}

def get_queryset(self):
queryset = super().get_queryset()
user = self.request.user
Copy link
Owner

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
Copy link
Owner

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)
Copy link
Owner

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)
Copy link
Owner

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants