49 lines
1.8 KiB
Python
49 lines
1.8 KiB
Python
from django.db import models
|
|
|
|
|
|
class PhaseVoiceLine(models.Model):
|
|
class CueKey(models.TextChoices):
|
|
INTRO = "intro", "Intro"
|
|
LOBBY = "lobby", "Lobby"
|
|
LIE = "lie", "Lie"
|
|
GUESS = "guess", "Guess"
|
|
REVEAL = "reveal", "Reveal"
|
|
SCOREBOARD = "scoreboard", "Scoreboard"
|
|
FINISHED = "finished", "Finished"
|
|
|
|
game_key = models.CharField(max_length=64, default="fupogfakta")
|
|
cue_key = models.CharField(max_length=32, choices=CueKey.choices)
|
|
locale = models.CharField(max_length=12, default="en")
|
|
text = models.TextField()
|
|
audio_file = models.FileField(upload_to="voice/phase/", blank=True, null=True)
|
|
is_active = models.BooleanField(default=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
class Meta:
|
|
ordering = ["game_key", "cue_key", "locale"]
|
|
unique_together = (("game_key", "cue_key", "locale"),)
|
|
|
|
def __str__(self):
|
|
return f"{self.game_key}:{self.cue_key}:{self.locale}"
|
|
|
|
|
|
class QuestionVoiceLine(models.Model):
|
|
class CueKey(models.TextChoices):
|
|
QUESTION_PROMPT = "question_prompt", "Question prompt"
|
|
QUESTION_REVEAL = "question_reveal", "Question reveal"
|
|
|
|
question = models.ForeignKey("fupogfakta.Question", on_delete=models.CASCADE, related_name="voice_lines")
|
|
cue_key = models.CharField(max_length=32, choices=CueKey.choices)
|
|
locale = models.CharField(max_length=12, default="en")
|
|
text = models.TextField()
|
|
audio_file = models.FileField(upload_to="voice/question/", blank=True, null=True)
|
|
is_active = models.BooleanField(default=True)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
class Meta:
|
|
ordering = ["question_id", "cue_key", "locale"]
|
|
unique_together = (("question", "cue_key", "locale"),)
|
|
|
|
def __str__(self):
|
|
return f"{self.question_id}:{self.cue_key}:{self.locale}"
|