fixed supermarket category creation

This commit is contained in:
vabene1111 2022-03-01 16:26:36 +01:00
parent c5df241ec3
commit 55539c83c9

View File

@ -337,7 +337,7 @@ class SupermarketCategorySerializer(UniqueFieldsMixin, WritableNestedModelSerial
def create(self, validated_data):
name = validated_data.pop('name').strip()
space = validated_data.pop('space', self.context['request'].space)
obj, created = SupermarketCategory.objects.get_or_create(name__iexact=name, space=space, defaults=validated_data)
obj, created = SupermarketCategory.objects.get_or_create(name=name, space=space)
return obj
def update(self, instance, validated_data):