platform/configs/models.py
2023-09-26 09:56:08 +03:00

23 lines
575 B
Python

from json import dumps
from django.db import models
# Create your models here.
class Config(models.Model):
name = models.TextField()
data = models.JSONField(default=dict)
project = models.ForeignKey('web.Project', on_delete=models.CASCADE)
stage = models.TextField(default='production')
@property
def data_pretty(self):
return dumps(self.data, indent=4, ensure_ascii=False)
class Meta:
indexes = [
models.Index(fields=['project', 'stage']),
models.Index(fields=['project', 'name', 'stage'])
]