1👍
✅
remember that GENDERCHOICES is either a class member of NameModel or a tuple defined at your Customer app models.py
just import it and use it as you normally would, in your models.py file:
from Customer.models import NameModel
ExampleModel(models.Model):
type = models.CharField(max_length=1,choices=NameModel.GENDERCHOICES)
or …
from Customer.models import GENDERCHOICES
ExampleModel(models.Model):
type = models.CharField(max_length=1,choices=GENDERCHOICES)
if your tuple is not defined inside the NameModel class.
Cheers.
EDIT
to edit a tuple you have to convert it to a list append to it and then convert back to a tuple:
l = list(GENDERCHOICES)
l.append(((9,("Something else")))
GENDERCHOICES_EXTRA = tuple(l)
hope this helps
Source:stackexchange.com