Hello,

You can create a new validator where domains are validate and insert it as
second validator.

Regards

Sencer Hamarat <sencerhama...@gmail.com> schrieb am Di., 14. Juni 2022,
15:16:

> Hi,
>
> Say, I have an email field in a model and need to add an email validator
> for email domain validation.
> For this, allowlist property needs to be append to email validator like:
>
> email = models.EmailField(
>     validators=[
>         EmailValidator(allowlist=['example1.com', 'example2.com',...])
>     ]
> )
>
> Can I dynamically fetch domains from another model and assign to allowlist?
> "allowlist" must be altered instantly if related domain list model records
> are changed.
>
> Regards,
> Sencer HAMARAT
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACp8TZgUP9PFB4Rgbhc2sPBvUZ56fy-HFB5AuAxCs8bejo-ahQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACp8TZgUP9PFB4Rgbhc2sPBvUZ56fy-HFB5AuAxCs8bejo-ahQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAKGT9mzdV9urxOA-vsYSmMbHT6BBPSSnKZCGPAG%3DEwOj47dw7A%40mail.gmail.com.

Reply via email to