jazzband / django-smart-selects

chained and grouped selects for django forms
https://django-smart-selects.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
1.1k stars 348 forks source link

Change force_text to force_str to remove RemoveInDjango40Warning #311

Closed rhenter closed 3 years ago

rhenter commented 3 years ago

Change force_text to force_str to remove RemoveInDjango40Warning

.../smart_selects/utils.py:73: RemovedInDjango40Warning: force_text() is deprecated in favor of force_str().
  results.sort(key=lambda x: unicode_sorter(force_text(x)))
.../smart_selects/utils.py:55: RemovedInDjango40Warning: force_text() is deprecated in favor of force_str().
  {'value': item.pk if str(item.pk).isdigit() else str(item.pk), 'display': force_text(item)} for item in results
manelclos commented 3 years ago

Hi @rhenter thanks for the PR. It seems tests are not passing, maybe we need it to conditionally use one function or another depending on the Django version. I'd not like to drop support for Django 1.8 until we release a new major version.

rhenter commented 3 years ago

Make sense! I'm closing this PR

manelclos commented 3 years ago

@rhenter you can reuse this PR and squash commits at the end.