mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-07 23:28:16 -05:00
fixed supermarket category creation
This commit is contained in:
@@ -337,7 +337,7 @@ class SupermarketCategorySerializer(UniqueFieldsMixin, WritableNestedModelSerial
|
|||||||
def create(self, validated_data):
|
def create(self, validated_data):
|
||||||
name = validated_data.pop('name').strip()
|
name = validated_data.pop('name').strip()
|
||||||
space = validated_data.pop('space', self.context['request'].space)
|
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
|
return obj
|
||||||
|
|
||||||
def update(self, instance, validated_data):
|
def update(self, instance, validated_data):
|
||||||
|
|||||||
Reference in New Issue
Block a user