Идеи по оптимизации пользовательских колонок в моделях django
В базе данных есть сотни пользовательских столбцов, а отображение в моделях является сложным. Мне нужно решение, как мы можем сократить приведенный ниже код.
<class LS_Additional_Values(models.Model):
LSCode = models.CharField(db_column='LSCode',primary_key=True,max_length=8)
LSFirmCode = models.DecimalField(db_column='LSFirmCode', max_digits=4, decimal_places=0)
Table = models.CharField(db_column='Table', max_length=100)
pkey = models.CharField(db_column='pKey', max_length=50,null=False)
Custom1 = models.CharField(db_column='Custom1', max_length=500,null=True)
Custom2 = models.CharField(db_column='Custom2', max_length=500,null=True)
Custom3 = models.CharField(db_column='Custom3', max_length=500,null=True)
Custom4 = models.CharField(db_column='Custom4', max_length=500,null=True)
Custom5 = models.CharField(db_column='Custom5', max_length=500,null=True)
Custom6 = models.CharField(db_column='Custom6', max_length=500,null=True)
Custom7 = models.CharField(db_column='Custom7', max_length=500,null=True)
Custom8 = models.CharField(db_column='Custom8', max_length=500,null=True)
Custom9 = models.CharField(db_column='Custom9', max_length=500,null=True)
Custom10 = models.CharField(db_column='Custom10', max_length=500,null=True)
Custom11 = models.CharField(db_column='Custom11', max_length=500,null=True)
Custom12 = models.CharField(db_column='Custom12', max_length=500,null=True)
Custom13 = models.CharField(db_column='Custom13', max_length=500,null=True)
Custom14 = models.CharField(db_column='Custom14', max_length=500,null=True)
Custom15 = models.CharField(db_column='Custom15', max_length=500,null=True)
.......
Custom97 = models.CharField(db_column='Custom97', max_length=500,null=True)
Custom98 = models.CharField(db_column='Custom98', max_length=500,null=True)
Custom99 = models.CharField(db_column='Custom99', max_length=500,null=True)
Custom100 = models.CharField(db_column='Custom100', max_length=500,null=True)
Created_by = models.CharField(db_column='Created By', max_length=100)
Date_Of_Item_Created = models.DateField(db_column='Date Of Item Created')
Modified_by = models.CharField(db_column='Modified By',max_length=100)
Date_of_Modification = models.DateTimeField(db_column='Date of Modification')
Вот код, написанный в models.py в Django на данный момент.