Conversation
upy
left a comment
There was a problem hiding this comment.
var olan migration dosyalarina ozel durumlar haric dokunmamayi tercih ediyoruz.
| @@ -1,6 +1,5 @@ | |||
| # Generated by Django 3.2.9 on 2021-12-03 17:37 | |||
There was a problem hiding this comment.
migration dosyalarina dokunmamaliyiz.
| existing_basket_item.quantity += quantity | ||
| existing_basket_item.save() | ||
| else: | ||
| new_basket_item = BasketItem(basket=basket, product=product, quantity=quantity, price=price) |
There was a problem hiding this comment.
model objelerini kullanmak yerine serializerlari kullanmak daha iyi fikir.
| def create(self, validated_data): | ||
| password = validated_data.pop("password", None) | ||
| password_repeat = validated_data.pop("password_repeat", None) | ||
| instance = self.Meta.model(**validated_data) |
There was a problem hiding this comment.
manager'imizda create_user seklinde guzel bir methodumuz var.
| class Meta: | ||
| model = Customer | ||
| fields = ("email", "password", "password_repeat") | ||
| extra_kwargs = {"password": {"write_only": True}, "password_repeat": {"write_only": True}} |
There was a problem hiding this comment.
yukarida tanimladigimiz bir field oldugundan buraya koymamizin bir anlami olmuyor. (password_repeat)
| return queryset.filter(customer=user) | ||
|
|
||
| @action(detail=True, methods=['post', 'put']) | ||
| def add_to_basket(self, request, pk=None): |
There was a problem hiding this comment.
kayit ekleme/guncelleme, valitation islemleri serializer tarafinda yapilmasi daha iyi olacaktir.
|
|
||
| def get_queryset(self): | ||
| queryset = super().get_queryset() | ||
| user = self.request.user |
There was a problem hiding this comment.
login olmamis kullanici durumu soz konusu ise burada problem olusuyor sanki?
Because of the pulling error at the start, even though I shouldn't change the migration files I had to.