[Fixed]-Django admin doesnot reflect dynmaic choices in choiceField

1👍

In Django 1.9, I’m doing this way

from django.utils.functional import lazy

class ModelA(models.Model):

    field1 = models.CharField(max_length=255, blank=False, null=False)
    # ..

    def __init__(self, *args, **kwargs):
        super(ModelA, self).__init__(*args, **kwargs)
        self._meta.get_field('field1').choices = lazy(get_field1_list, list)()

NOTE that i’m using lazy. you can ignore that

Leave a comment