formatting head

This commit is contained in:
Acid
2025-12-27 15:33:48 -05:00
commit 6f3bdd61d4
63 changed files with 6935 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
from django.db import models
import string
import random
# Create your models here.
def generate_unique_code():
length = 6
while True:
code = ''.join(random.choices(string.ascii_uppercase, k=length))
if not Room.objects.filter(code=code).exists():
return code
class Room(models.Model):
code = models.CharField(max_length=8, default=generate_unique_code, unique=True)
host = models.CharField(max_length=50, unique=True)
guest_can_pause = models.BooleanField(null=False, default=False)
votes_to_skip = models.IntegerField(null=False, default=1)
created_at = models.DateTimeField(auto_now_add=True)