Change choices attribute of model's field
问题 This question is similar to Set model field choices attribute at run time? However, my problem is that I want to change the default value of the choices attribute, at class level. I have this class Project(models.Model): name = models.CharField(...) @staticmethod def getAllProjectsTuple(): return tuple([(p.id, p.name) for p in Project.objects.all()]) class Record(models.Model): project = models.ForeignKey( Project, verbose_name='Project', help_text='Project name', blank=True, null=True, on