configs
This commit is contained in:
22
configs/models.py
Normal file
22
configs/models.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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'])
|
||||
]
|
Reference in New Issue
Block a user