django-rest-framework-bulk icon indicating copy to clipboard operation
django-rest-framework-bulk copied to clipboard

Field Unique fails when trying to bulk update

Open jrujano-zz opened this issue 4 years ago • 0 comments

Model

class Email(models.Model):

email = models.EmailField("Email", unique=True)

Trying to upgrade to a model with a field with the value of unique = true; generates the following error:

/lib/python3.6/site-packages/rest_framework/validators.py", line 71, in exclude_current_instance
    return queryset.exclude(pk=self.instance.pk)

Exception Type: AttributeError at /contracts/api/requestboxup/
Exception Value: 'QuerySet' object has no attribute 'pk'

Note: removing the unique = true property; it works perfectly

jrujano-zz avatar Apr 24 '20 22:04 jrujano-zz