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

Conversation

@aysenuryazicii
Copy link

No description provided.

serializer = CountrySerializer(data=country, many=True)
serializer.is_valid(raise_exception=True)
serializer.save()
city.categories.add(*serializer.instance)

Choose a reason for hiding this comment

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

city objesinin categories adında bir fieldı yok.

city nin country fieldı zorunlu olduğundan oluşturabilmek için önce country oluşturman gerekli.


class BankAccountFilter(filters.FilterSet):
name = filters.CharFilter(label=_("Bank Account Name"), lookup_expr="icontains")
iban = filters.CharFilter(label=_("Phone"), lookup_expr="iexact")

Choose a reason for hiding this comment

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

label=iban

def create(self, validated_data):
bank = validated_data.pop("bank", None)
bank_account = super().create(validated_data)
if bank:

Choose a reason for hiding this comment

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

önce bank objesini oluşturman ve bank accounta parametre olarak vermen gerekli.



class BasketFilter(filters.FilterSet):
customer = CustomerFilter
Copy link
Owner

Choose a reason for hiding this comment

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

boyle bir kullanimi nereden ogrendik?

fields = ("id", "name", "country")

@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.

ProductDetailedSerializer icerisinde ornek olmasi acisindan vermistik, genelde detailed serializerlari sadece veri gostermek icin aliyoruz ve kayit yapmak ve guncellemek icin kullanmiyoruz, ozel durumlar yoksa kayit create/update islemleri icin genel olarak nested olmayan serializer'i kullaniyoruz.

'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend']
'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'PAGE_SIZE': 100
Copy link

Choose a reason for hiding this comment

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

Page Number Pagination daha iyi olabilir.

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.

4 participants