-
Notifications
You must be signed in to change notification settings - Fork 30
Utkuaysev homework 4 #109
base: main
Are you sure you want to change the base?
Utkuaysev homework 4 #109
Conversation
|
|
||
| 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 customer varsa sanki problem var.
|
|
||
| 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 customer varsa sanki problem var.
| copy_data["basket_id"] = pk | ||
| serializer = BasketItemSerializer(data=copy_data) | ||
| if serializer.is_valid(): | ||
| BasketItem.create(copy_data) |
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 islemlerini modeller uzerinden degil de serializer uzerinden yapmak daha iyi bir fikir.
| ) | ||
|
|
||
| def create(self, validated_data): | ||
| user = Customer.objects.create( |
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.
manager uzerinde create_user isminde guzel bir methodumuz var.
/baskets/<basket_id>/add_basket_itemautomatically saved to <basket_id> basket.