Skip to content

Commit

Permalink
Remove model field .choices fixer (#425)
Browse files Browse the repository at this point in the history
Refs #417.
  • Loading branch information
adamchainz authored Feb 11, 2024
1 parent d14b93f commit 76db0c5
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 238 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
Changelog
=========

* Remove the Django 5.0+ fixer that dropped ``.choices`` from model field ``choices`` parameters.
It was too unreliable because it could break use for “DIY” enumeration types.

Thanks to Niccolò Mineo and washeck for reporting in `Issue #417 <https://github.com/adamchainz/django-upgrade/issues/417>`__.

* Add Django 1.10+ fixer to rewrite ``request.user`` functions that changed to boolean attributes: ``is_authenticated`` and ``is_anonymous``.

Thanks to Alessandro Ferrini in `PR #423 <https://github.com/adamchainz/django-upgrade/pull/423>`__.
Expand Down
12 changes: 1 addition & 11 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -988,14 +988,4 @@ Django 5.0

`Release Notes <https://docs.djangoproject.com/en/5.0/releases/5.0/>`__

Model field ``choices=<name>.choices``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Drop ``.choices`` for model field ``choices`` parameters.
This parameter now accepts enumeration types directly.

.. code-block:: diff
class Card(models.Model):
- suit = models.IntegerField(choices=Suit.choices, default=Suit.DEFAULT)
+ suit = models.IntegerField(choices=Suit, default=Suit.DEFAULT)
No fixers yet.
58 changes: 0 additions & 58 deletions src/django_upgrade/fixers/model_field_choices.py

This file was deleted.

169 changes: 0 additions & 169 deletions tests/fixers/test_model_field_choices.py

This file was deleted.

0 comments on commit 76db0c5

Please sign in to comment.