#35854: Order of "choices" on CharField randomly changing forcing new migrations
despite no changes.
----------------------------+--------------------------------------
     Reporter:  Karl        |                    Owner:  (none)
         Type:  Bug         |                   Status:  closed
    Component:  Migrations  |                  Version:  5.1
     Severity:  Normal      |               Resolution:  duplicate
     Keywords:              |             Triage Stage:  Unreviewed
    Has patch:  0           |      Needs documentation:  0
  Needs tests:  0           |  Patch needs improvement:  0
Easy pickings:  0           |                    UI/UX:  0
----------------------------+--------------------------------------
Comment (by Natalia Bidart):

 Claude, Karl, your points make sense and I'm happy to go with the majority
 here. We already have
 
[https://github.com/django/django/blob/main/django/db/models/fields/__init__.py#L321
 a check for choices], it would be trivial to check against "unorderable
 iterables":

 {{{#!python
         if not isinstance(self.choices, Iterable) or
 isinstance(self.choices, str):
             return [
                 checks.Error(
                     "'choices' must be a mapping (e.g. a dictionary) or an
 iterable "
                     "(e.g. a list or tuple).",
                     obj=self,
                     id="fields.E004",
                 )
             ]
 }}}

 I'm thinking we may need to reopen #29609 and repurpose that ticket to
 grow the system check for choices? Claude what do you think?
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35854#comment:9>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070192b6ec87eb-5856ceb7-c7b2-4863-b9a9-e7242232311a-000000%40eu-central-1.amazonses.com.

Reply via email to