I have a long list of 100 labels I need my model to have as fields and to also call in succession to access them in other parts of code. I am going to need to modify them in the future so I would like to be able to do it in one place. Is there a simple way to do this. For example:
labels = ['height', 'weight', 'age']
In models.py
class MyModel(models.Model):
for label in labels:
label = models.CharField(max_length=255)
Would the above be equal to :
class MyModel(models.Model):
height = models.CharField(max_length=255)
weight = models.CharField(max_length=255)
age = models.CharField(max_length=255)