23 lines
555 B
Python
23 lines
555 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)
|
|
|
|
class Meta:
|
|
indexes = [
|
|
models.Index(fields=['project', 'stage']),
|
|
models.Index(fields=['project', 'name', 'stage'])
|
|
]
|