#30857: When subclassing a model field, `max_length` cannot be passed as an
argument to `self.__init__`.
-------------------------------------+-------------------------------------
Reporter: Robin (Robert) | Owner: nobody
Thomas |
Type: Bug | Status: closed
Component: Documentation | Version: 2.2
Severity: Normal | Resolution: invalid
Keywords: models fields | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by felixxm):
* status: new => closed
* component: Uncategorized => Documentation
* type: Uncategorized => Bug
* resolution: => invalid
Comment:
You can pass it directly but you have to add `deconstruct()` (see
[https://docs.djangoproject.com/en/2.2/howto/custom-model-fields/#field-
deconstruction documentation]):
{{{
def deconstruct(self):
name, path, args, kwargs = super().deconstruct()
del kwargs['max_length']
return name, path, args, kwargs
}}}
Closing per TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/30857#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/072.56daf66290f0764358a277166747a445%40djangoproject.com.