forked from CGM_Public/pretix_original
Make available languages configurable
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
from django.views.generic import edit
|
||||
|
||||
|
||||
class EventBasedFormMixin:
|
||||
|
||||
def get_form_kwargs(self):
|
||||
kwargs = super().get_form_kwargs()
|
||||
if hasattr(self.request, 'event'):
|
||||
kwargs['event'] = self.request.event
|
||||
return kwargs
|
||||
|
||||
|
||||
class CreateView(EventBasedFormMixin, edit.CreateView):
|
||||
"""
|
||||
Like Django's default CreateView, but passes the optional event
|
||||
argument to the form. This is necessary for I18nModelForms to work
|
||||
properly.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
class UpdateView(EventBasedFormMixin, edit.UpdateView):
|
||||
"""
|
||||
Like Django's default UpdateView, but passes the optional event
|
||||
argument to the form. This is necessary for I18nModelForms to work
|
||||
properly.
|
||||
"""
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user