I have a model charfield which has dynamic choices
class MachineChoices(object):
def get_machine_choices(self):
# call external service to get a full list of machines
...
def __iter__(self):
yield from self.get_machine_choices()
class ExceptionMapping(models.Model):
machine_id = models.IntegerField(null=True, blank=True, choices=MachineChoices())
My problem is that when I run makemigrations
it will generate a migration for the field with all the choices.
How do I get around this without such gigantic migration. Deleting this migration manually each time running makemigrations
is a pain in the butt.
Please Note: I am asking why this is happening as I have already asked before.