In models.py
class DeploymentType(models.Model):
deployment_type = models.CharField(primary_key=True, max_length=30, verbose_name="Deployment Type",blank=True)
def __str__(self):
return self.deployment_type
class ActivationType (models.Model) :
activation_type = models.CharField (
primary_key=True,
max_length=20,
verbose_name = "Activation Type"
)
permitted_host_methods = models.ManyToManyField(
HostMethod,
verbose_name = "Permitted Host Methods"
)
permitted_deployment_types = models.ManyToManyField(
DeploymentType,
verbose_name = "Permitted Deployment Types" )
class Meta:
verbose_name = "Activation Type"
def __str__(self):
return str(self.activation_type)
But then on the Django admin page, I can't create a new Activation Type without selecting a Permitted Deployment Type. Furthermore, if I go into an existing Activation Type I am not sure how to select zero Permitted Deployment Types. I believe I am using Django 3.1.1