mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 00:25:41 +01:00
Fix: no-changes on board name should be allowed
This commit is contained in:
@@ -221,10 +221,11 @@ class BoardSerializer(serializers.HyperlinkedModelSerializer):
|
||||
def update(self, instance: Board, validated_data):
|
||||
pins_to_add = validated_data.pop("pins_to_add", [])
|
||||
pins_to_remove = validated_data.pop("pins_to_remove", [])
|
||||
if Board.objects.filter(
|
||||
board = Board.objects.filter(
|
||||
submitter=instance.submitter,
|
||||
name=validated_data.get('name', None)
|
||||
).exists():
|
||||
).first()
|
||||
if board.id != instance.id:
|
||||
raise ValidationError(
|
||||
detail={'name': "Board with this name already exists"}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user