Skip to content

Instantly share code, notes, and snippets.

@thiagoferreiraw
Last active September 1, 2021 13:21
Show Gist options
  • Save thiagoferreiraw/24fb39109ff64e648032b1e07dd98938 to your computer and use it in GitHub Desktop.
Save thiagoferreiraw/24fb39109ff64e648032b1e07dd98938 to your computer and use it in GitHub Desktop.
Medium - Metabase + Django
class ReportEngine(BaseModel, models.Model):
id = HashedAutoField(primary_key=True)
name = models.CharField(max_length=250)
type = models.CharField(
choices=(("metabase", "Metabase"),), default="metabase", max_length=50
)
base_url = models.URLField()
integration_api_key = models.CharField(max_length=250)
class EmbeddedReport(BaseModel, models.Model):
id = HashedAutoField(primary_key=True)
name = models.CharField(max_length=250)
engine = models.ForeignKey(ReportEngine, on_delete=models.PROTECT)
reference_id = models.CharField(
help_text="Report ID on the engine, like question id, dashboard id on Metabase",
max_length=50,
)
reference_type = models.CharField(
choices=(
("single_report", "Question/Single Report"),
("dashboard", "Dashboard"),
),
max_length=50,
)
active = models.BooleanField(default=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment