Skip to content

🐛 AttributeError: 'ModelSelect2MultipleWidget' object has no attribute 'uuid' in v8.4.1 #326

Closed
@nizarcan

Description

@nizarcan

Bug Description

After upgrading to django-select2 v8.4.1, ModelSelect2MultipleWidget and other HeavySelect2Mixin subclasses throw AttributeError: 'ModelSelect2MultipleWidget' object has no attribute 'uuid' when rendering. This appears to be a regression introduced by the security fix in v8.4.1

The issue occurs because uuid generation was moved from __init__ to build_attrs in v8.4.1, but _get_cache_key is called earlier in the render flow (render()set_to_cache()_get_cache_key())

Steps to Reproduce

1- Install django-select2 v8.4.1
2- Create any widget inheriting from ModelSelect2MultipleWidget or HeavySelect2Mixin
3- Try to render the widget in a form

Expected Behavior

Widget should render without errors, as it did in v8.4.0

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions