This is my existing django model
class Account(models.Model):
env = CharField(max_length=10)
now I need to add period
field to my model based on the value of the env
field in model. I can get the period
value based on the env
from following dict in my settings
file
mydict = {
'dev':1,
'prd':2
}
How do I add my period field to model?
period = Integerfield(default=setvalue from dict)
period
field to the existing models, only after manually save the object again the field get updated