#34183: Add a ChoicesMeta.max_length property returning the max_length when data
type supports len()
--------------------------------+------------------------------------------
     Reporter:  Coumes Quentin  |                    Owner:  Coumes Quentin
         Type:  New feature     |                   Status:  assigned
    Component:  Utilities       |                  Version:  4.1
     Severity:  Normal          |               Resolution:
     Keywords:  choices, enums  |             Triage Stage:  Unreviewed
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------------
Description changed by Coumes Quentin:

Old description:

> It would be helpful for enums inheriting {{{Choices}}} with a data type
> supporting {{{len()}}} to be able to compute {{{max_length}}} by
> themselves.
>
> This would make the definition of field's {{{max_length}}} easier as well
> as automatically create a new migration when deleting/adding members
> which would change the {{{max_length}}}.
>
> If the data type does not support {{{len()}}, it could raise
> {{{TypeError}}} (same exception raise by {{{len}}}) something like :
>
> {{{
> raise TypeError("Can only compute max_length on data type supporting
> len()")
> }}}
>
> I can do the patch if this feature does make sense to you.

New description:

 It would be helpful for enums inheriting {{{Choices}}} with a data type
 supporting {{{len()}}} to be able to compute {{{max_length}}} by
 themselves.

 This would make the definition of field's {{{max_length}}} easier as well
 as automatically create a new migration when deleting/adding members which
 would change the {{{max_length}}}.

 If the data type does not support {{{len()}}}, it could raise
 {{{TypeError}}} (same exception raise by {{{len}}}) something like :

 {{{
 raise TypeError("Can only compute max_length on data type supporting
 len()")
 }}}

 I can do the patch if this feature does make sense to you.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/34183#comment:2>
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/01070184ae743a4e-403e2afd-a6c8-4507-b248-a08d39be0437-000000%40eu-central-1.amazonses.com.

Reply via email to