agateblue / django-dynamic-preferences

Dynamic global and instance settings for your django project
https://django-dynamic-preferences.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
350 stars 87 forks source link

Fix modelmultipleserializer PATCH API call, fixes #291 #293

Closed jkcgs closed 1 year ago

jkcgs commented 1 year ago

If you make a PATCH call to a dynprefs endpoint to update a ModelMultipleChoicePreference field, it will not correctly handle the list of PKs. It will transform the value to a list of model instances, which is not handled by the field serializer, as you can see at the issue #291.

With this patch that list of model instances is transformed to a list of their PKs.

The tests were previously failing so I'm not touching those.