vue可视化报表平台后台代码
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

70 linhas
3.0 KiB

5 anos atrás
from django.db import models
from django.contrib.auth.models import User
from django.utils import timezone
def default_datetime():
4 anos atrás
now = timezone.now()
return now
5 anos atrás
class SourceDataBase(models.Model):
4 anos atrás
host = models.CharField(max_length=32)
port = models.IntegerField()
username = models.CharField(max_length=32)
password = models.CharField(max_length=256)
database = models.CharField(max_length=32)
base_alias = models.CharField(max_length=32)
creator = models.ForeignKey(User, on_delete=models.CASCADE)
source_id = models.CharField(max_length=64, primary_key=True)
is_private = models.BooleanField(default=True)
status = models.IntegerField(default=1)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)
class SourceDataTable(models.Model):
4 anos atrás
database = models.ForeignKey(SourceDataBase, on_delete=models.CASCADE)
table = models.CharField(max_length=32)
table_alias = models.CharField(max_length=32)
status = models.IntegerField(default=1)
creator = models.ForeignKey(User, on_delete=models.CASCADE)
id = models.CharField(max_length=64, primary_key=True)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)
5 anos atrás
# Create your models here.
class Chart(models.Model):
4 anos atrás
chart_id = models.CharField(max_length=64, primary_key=True)
chart_name = models.CharField(max_length=128)
source_id = models.ForeignKey(SourceDataBase, on_delete=models.CASCADE)
desc = models.CharField(max_length=512, null=True)
content = models.TextField()
is_private = models.BooleanField()
status = models.IntegerField()
creator = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)
5 anos atrás
class Dashboard(models.Model):
4 anos atrás
dashboard_id = models.CharField(max_length=64, primary_key=True)
name = models.CharField(max_length=128)
desc = models.CharField(max_length=512, null=True)
content = models.TextField()
is_private = models.BooleanField()
status = models.IntegerField()
creator = models.ForeignKey(User, on_delete=models.CASCADE)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)
5 anos atrás
class ChartBoardMap(models.Model):
4 anos atrás
chart = models.ForeignKey(Chart, on_delete=models.CASCADE)
dashboard = models.ForeignKey(Dashboard, on_delete=models.CASCADE)
id = models.CharField(max_length=64, primary_key=True)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)
5 anos atrás
class BoardOrder(models.Model):
4 anos atrás
creator = models.ForeignKey(User, on_delete=models.CASCADE)
order = models.TextField()
id = models.CharField(max_length=64, primary_key=True)
created_at = models.DateTimeField(db_index=True, default=default_datetime)
updated_at = models.DateTimeField(db_index=True, null=False)