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

Conversation

@ecanyazgi
Copy link

Because of the pulling error at the start, even though I shouldn't change the migration files I had to.

Copy link
Owner

@upy upy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kayit ekleme/guncelleme, valitation islemleri serializer tarafinda yapilmasi daha iyi olacaktir.


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 kullanici durumu soz konusu ise burada problem olusuyor sanki?

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