pretalx-musicrate/pretalx_musicrate/forms.py

18 lines
460 B
Python
Raw Normal View History

2023-12-13 23:58:00 +01:00
from i18nfield.forms import I18nModelForm
from .models import MusicrateSettings
class MusicrateSettingsForm(I18nModelForm):
def __init__(self, *args, event=None, **kwargs):
self.instance, _ = MusicrateSettings.objects.get_or_create(event=event)
super().__init__(*args, **kwargs, instance=self.instance, locales=event.locales)
class Meta:
model = MusicrateSettings
fields = ("some_setting", )
widgets = {}