jazzband/django-smart-selects

ChainedModelChoiceField.choices initialization incompatibility with Django 5.0

Dmitri-Sintsov opened this issue · 11 comments

Checklist

  • This issue is not about installing previous versions of django-smart-selects older than 1.2.8. I understand that previous versions are insecure and will not receive any support whatsoever.
  • I have verified that that issue exists against the master branch of django-smart-selects.
  • I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
  • I have debugged the issue to the smart_selects app.
  • I have reduced the issue to the simplest possible case.
  • I have included all relevant sections of models.py, forms.py, and views.py with problems.
  • I have used GitHub Flavored Markdown to style all of my posted code.

Steps to reproduce

The following error is being produced while the initialization of Django 5.0 project:

 File "/home/user/work/ispdevenv/lib/python3.10/site-packages/smart_selects/db_fields.py", line 8, in <module>
    from smart_selects import form_fields
  File "/home/user/work/ispdevenv/lib/python3.10/site-packages/smart_selects/form_fields.py", line 10, in <module>
    class ChainedModelChoiceField(ModelChoiceField):
  File "/home/user/work/ispdevenv/lib/python3.10/site-packages/smart_selects/form_fields.py", line 62, in ChainedModelChoiceField
    choices = property(_get_choices, ChoiceField._set_choices)
AttributeError: type object 'ChoiceField' has no attribute '_set_choices'

Actual behavior

Impossible to initialize ChainedModelChoiceField.choices.

Expected behavior

Used to work fine with Django<5.0

See django/django@500e010 for the reference.