lincolnloop / django-dynamic-raw-id

(formerly known as django-salmonella) A raw_id_fields widget replacement that handles display of an object's string value on change and can be overridden via a template.
MIT License
163 stars 55 forks source link

"Enter a list of values" error apparently due to value_from_datadict removal #103

Closed chellman closed 5 months ago

chellman commented 5 months ago

I'm glad to see the compatibility update, but I think something was removed that shouldn't have been.

dynamic_raw_id.widgets.DynamicRawIDMultiIdWidget.value_from_datadict doesn't exist anymore, and when I save a model with dynamic_raw_id_fields = (my_field), values like this:

33,22,11

Get transformed to this:

3,3,,2,2,,1,1

Causing an invalid list error with "Enter a list of values." displayed.

Poking around in the code, I found that restoring the missing function above, removed here, restores the expected behavior.

(Edit - PR is up.)

bartTC commented 5 months ago

What Python and Django version do you use? This is pretty intensively tested so I'm wondering how that could come up now.

bartTC commented 5 months ago

CleanShot 2024-06-18 at 12 02 18@2x

Nevermind, I see an issue as well.

bartTC commented 5 months ago

v4.2 https://pypi.org/project/django-dynamic-raw-id/ has been released with your fix. Thank you for the report, investigation and provided fix.

While the widget itself is tested, its actually never checked that data is retained correctly after the save of the admin change form itself.

chellman commented 5 months ago

I'll use a little bit of German I know. Vielen dank, Martin! I really appreciate you taking the time on this.