aircox/views/episode: render selected attribute on option 0

This commit is contained in:
Chris Tactic 2024-11-08 11:54:32 +01:00
parent 8ecf71b96e
commit cae5bdc1d8

View File

@ -60,6 +60,13 @@ class EpisodeUpdateView(UserPassesTestMixin, VueFormDataMixin, PageUpdateView):
form_class = forms.EpisodeForm
template_name = "aircox/episode_form.html"
def get_form_kwargs(self, *args, **kwargs):
"""Render selected attribute on option 0."""
fk = super().get_form_kwargs(*args, **kwargs)
if not fk["instance"].status:
fk["initial"]["status"] = "0"
return fk
def can_edit(self, obj):
return self.test_func()