django-choices
django-choices copied to clipboard
Upcoming 'native' choices model support in Django 3.0
It appears the upcoming Django 3.0 release (expected December 2019) will have something very similar built in (although the syntax is slightly different): https://docs.djangoproject.com/en/dev/releases/3.0/#enumerations-for-model-field-choices
I haven't looked into it too deeply but it appears the new built-in functionality can do everything this app does and, well, it comes built-in with Django...
Maybe it's time to retire this app for future Django releases?
At the very least, the docs should start mentioning this when 3.0 lands.
(Of course, for the foreseeable future this is still a very useful app for those that are stuck on older versions!)
Correct, and I'm personally excited we finally have this feature in core Django!
At first look the API is slightly different, but close enough to make migrating to native Django choices straight forward.
I haven't looked into it too deeply but it appears the new built-in functionality can do everything this app does and, well, it comes built-in with Django...
One key difference is that django-choices supports passing arbitrary kwargs to ChoiceItem
, which you can access later and build some business logic around that. But I don't consider this a show stopper, as you can still maintain a separate mapping. I'm not sure how often this feature is used though, input would be welcome.
Maybe it's time to retire this app for future Django releases?
That's the plan. Not sure if we should still do one final release that detects Django 3.0+ and issues warnings to recommend you to use the core django stuff, or just not release for Django 3.0+ alltogether anymore.
Either way, a documentation update that tells you how to migrate seems the minimal effort required in both cases.
At the very least, the docs should start mentioning this when 3.0 lands.
For sure!
Migration documentation: https://django-choices.readthedocs.io/en/latest/migrating.html