new applets app for cross-board usage of Applet() & UserApplet() models; dashboard migrations reset and apps reseeded w. new default specs; core.settings & many tests thru-out suite updated accordingly
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
34
src/apps/applets/models.py
Normal file
34
src/apps/applets/models.py
Normal file
@@ -0,0 +1,34 @@
|
||||
from django.db import models
|
||||
|
||||
class Applet(models.Model):
|
||||
DASHBOARD = "dashboard"
|
||||
GAMEBOARD = "gameboard"
|
||||
CONTEXT_CHOICES = [
|
||||
(DASHBOARD, "Dashboard"),
|
||||
(GAMEBOARD, "Gameboard"),
|
||||
]
|
||||
|
||||
slug = models.SlugField(unique=True)
|
||||
name = models.CharField(max_length=100)
|
||||
context = models.CharField(max_length=20, choices=CONTEXT_CHOICES, default=DASHBOARD)
|
||||
default_visible = models.BooleanField(default=True)
|
||||
grid_cols = models.PositiveSmallIntegerField(default=12)
|
||||
grid_rows = models.PositiveSmallIntegerField(default=3)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
class UserApplet(models.Model):
|
||||
user = models.ForeignKey(
|
||||
"lyric.User",
|
||||
related_name="user_applets",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
applet = models.ForeignKey(
|
||||
Applet,
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
visible = models.BooleanField(default=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = ("user", "applet")
|
||||
Reference in New Issue
Block a user