#34961: Add a max_length parameter to EmailValidator
-------------------------------------+-------------------------------------
Reporter: jecarr | Owner: nobody
Type: | Status: closed
Cleanup/optimization |
Component: Core (Other) | Version: 4.2
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage:
| Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Natalia Bidart):
* status: new => closed
* resolution: => wontfix
Comment:
Hello, thank you for your report.
I'm not sure I understand your use case. Is it that you are not using
`EmailField` but you do use the `EmailValidator` in other type of field?
And if so, you'd like to set a length smaller than 320 chars?
If that's correct, you could define a subclass of `EmailValidator` and
check for the smaller value:
{{{#!python
class MyEmailValidator(EmailValidator):
def __call__(self, value):
if value and len(value) > your_limit_smaller_than_320:
raise ValidationError(self.message, code=self.code,
params={"value": value})
super().__call__(value)
}}}
I'll be closing this ticket as wontfix following the
[https://docs.djangoproject.com/en/4.2/internals/contributing/triaging-
tickets/#closing-tickets Ticket Triaging policy], but if I'm not
understanding your use case properly, please provide more details so we
can re-asses. A small Django project as a example would be great, or at
least models showcasing the use case.
Thanks!
--
Ticket URL: <https://code.djangoproject.com/ticket/34961#comment:1>
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/0107018bb6dcd410-dd4feef2-bd37-48bd-b065-1edfc850fb2c-000000%40eu-central-1.amazonses.com.