#34183: Add a ChoicesMeta.max_length property returning the max_length when data type supports len() ------------------------------------------+-------------------------------- Reporter: Coumes Quentin | Owner: nobody Type: New feature | Status: new Component: Utilities | Version: 4.1 Severity: Normal | 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 | ------------------------------------------+-------------------------------- 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> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/01070184ae735534-3728c436-a3d4-4702-9c50-c33f3e6a99ee-000000%40eu-central-1.amazonses.com.