pretalx-musicrate/pretalx_musicrate/forms.py

18 lines
460 B
Python

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 = {}