1
0
Fork 0
mirror of https://github.com/Kunsi/pretalx-plugin-broadcast-tools synced 2024-11-25 14:41:03 +00:00
pretalx-plugin-broadcast-tools/pretalx_broadcast_tools/views/orga.py

38 lines
1.1 KiB
Python
Raw Normal View History

2023-09-30 10:39:30 +00:00
from django.views.generic import FormView
2024-08-09 09:12:16 +00:00
from pretalx.common.views.mixins import PermissionRequired
2023-09-30 10:39:30 +00:00
from ..forms import BroadcastToolsSettingsForm
class BroadcastToolsOrgaView(PermissionRequired, FormView):
form_class = BroadcastToolsSettingsForm
permission_required = "orga.change_settings"
template_name = "pretalx_broadcast_tools/orga.html"
def get_success_url(self):
return self.request.path
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["localized_rooms"] = [
room.name.localize(self.request.event.locale)
for room in self.request.event.rooms.all()
]
return context
def form_valid(self, form):
form.save()
return super().form_valid(form)
def get_object(self):
return self.request.event
def get_form_kwargs(self):
kwargs = super().get_form_kwargs()
return {
"obj": self.request.event,
"attribute_name": "settings",
"locales": self.request.event.locales,
**kwargs,
}