We recently upgraded to 3.16.0. 
We started getting errors on this line:
https://github.com/encode/django-rest-framework/blob/c41314f1fc898490f27e1015cc859e28afe6f7b9/rest_framework/validators.py#L191C1-L191C87

Added with this PR:
https://github.com/encode/django-rest-framework/pull/9360


After some debugging we managed to narrow down that the error happens 
during a PATCH api call. We're only patching one field and get a KeyError 
on a field that is neither the patched one or  unique.

As a starting example, where a+b are unique together:
{
  "a": 1,
  "b": 2,
  "c": 3
}

When we Patch 
{
  "a": 5
}

We get the exception:
File 
"/usr/local/lib/python3.13/site-packages/rest_framework/validators.py", 
line 191, in __call__
condition_kwargs = {source: attrs[source] for source in 
self.condition_fields}
                                ~~~~~^^^^^^^^
KeyError: 'c'


Downgrading to 3.15.2, no exception is raised.

-- 
You received this message because you are subscribed to the Google Groups 
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-rest-framework/d62910d8-64bb-4667-a4fc-72ff4dbf1f32n%40googlegroups.com.

Reply via email to