tomchristie/django-rest-framework — pull request #2025 by jarrodb (2014-11-05 06:34:35+00:00)
Title: Do not require UniqueTogether validation for updates (PATCH) since the update may be partial.

This was a quick workaround when troubleshooting an issue when passing partial data via PATCH to update a resource where `unique_together` constraints were imposed on the model and the serializer validation was trying to enforce the uniqueness even though it only had partial data.

```python
class Extension(models.Model):
ext = models.CharField(max_length=255)
domain = models.ForeignKey(Domain)

class Meta:
db_table = 'extension'
unique_together = (("ext", "domain"),)
```

```python
class ExtensionSerializer(HyperlinkedModelSerializer):
domain = HrefRelatedField(view_name='domain-detail', lookup_field='name', queryset=Domain.objects.all())

class Meta(HyperlinkedModelSerializer.Meta):
model = Extension
fields = ('url', 'ext', 'domain')
```

PATCH http://testserver/v1/extensions/1/ --- {'domain': 'http://testserver/v1/domains/2/'}

Results in KeyError 'ext' because ModelSerializer.get_validators() looks for all fields specific in `unique_together` in the PATCH (partial) update.