feat(settings): add join token

This commit is contained in:
Luca 2023-12-15 02:32:20 +01:00
parent f04e114062
commit 300b932daa
2 changed files with 28 additions and 0 deletions

View File

@ -0,0 +1,21 @@
# Generated by Django 4.2.8 on 2023-12-15 01:30
from django.db import migrations, models
import pretalx_musicrate.models
class Migration(migrations.Migration):
dependencies = [
("pretalx_musicrate", "0002_musicratesettings_genre_question_and_more"),
]
operations = [
migrations.AddField(
model_name="musicratesettings",
name="join_token",
field=models.CharField(
default=pretalx_musicrate.models.generate_token, max_length=43
),
),
]

View File

@ -1,7 +1,13 @@
from secrets import token_urlsafe
from django.db import models from django.db import models
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
def generate_token():
return token_urlsafe(32)
class MusicrateSettings(models.Model): class MusicrateSettings(models.Model):
event = models.OneToOneField( event = models.OneToOneField(
to="event.Event", to="event.Event",
@ -33,3 +39,4 @@ class MusicrateSettings(models.Model):
blank=True, blank=True,
null=True, null=True,
) )
join_token = models.CharField(max_length=43, default=generate_token)