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

Conversation

@Naoiss
Copy link

@Naoiss Naoiss commented Dec 12, 2021

HOMEWORK 3

set serializers and filters, conf views and urls

Ömer Buğra Yıldırım

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.

create durumlarinda yazdigimiz basket.add, customer.add gib tanimlarin hata verdigini gormemizde fayda var.

class BasketSerializer(serializers.ModelSerializer):
class Meta:
model = Basket
read_only_fields = ['id', 'created_at', 'updated_at']
Copy link
Owner

Choose a reason for hiding this comment

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

bu alanlar zaten read_only degil mi?

serializer = CustomerSerializer(data=customer)
serializer.is_valid(raise_exception=True)
serializer.save()
basket.customer.add(*serializer.instance)
Copy link
Owner

Choose a reason for hiding this comment

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

sepet eklerken customer eklenmesi cok kullanisli gozukmiyor sanki?

product = ProductDetailedSerializer()

@atomic()
def create(self, 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.

genelde (ozel durumlar haric) detailed'lar ile create/update islemleri yapmamayi tercih ediyoruz.

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