Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To include numerous emails in an EmailField in a Django Model, you can use the CommaSeparatedEmailField field provided by the third-party package django-multiselectfield.

To use this package, you'll need to install it using pip:

pip install django-multiselectfield

Then, you can add it as a field in your model like this:

from django.db import models
from multiselectfield import MultiSelectField

class MyModel(models.Model):
    emails = MultiSelectField(choices=[('example1@example.com', 'example1@example.com'), ('example2@example.com', 'example2@example.com')], max_choices=10)

In the choices argument, you can specify all the email choices you want to provide for the field. The max_choices argument specifies the maximum number of emails that can be selected.

Note: Make sure to import the MultiSelectField from the multiselectfield package instead of the regular models module.