diff --git a/src/program/views.py b/src/program/views.py index 52a8ee39..8862f421 100644 --- a/src/program/views.py +++ b/src/program/views.py @@ -413,6 +413,10 @@ class CombinedProposalPersonSelectView(LoginRequiredMixin, CampViewMixin, ListVi return super().dispatch(request, *args, **kwargs) + def get_queryset(self, **kwargs): + # only show speaker proposals for the current user + return super().get_queryset().filter(user=self.request.user) + def get_context_data(self, **kwargs): """ Add EventType to template context @@ -421,6 +425,12 @@ class CombinedProposalPersonSelectView(LoginRequiredMixin, CampViewMixin, ListVi context['eventtype'] = self.eventtype return context + def get(self, request, *args, **kwargs): + """ If we don't have any existing SpeakerProposals just redirect directly to the combined submit view """ + if not self.get_queryset().exists(): + return redirect(reverse_lazy('program:proposal_combined_submit', kwargs={'camp_slug': self.camp.slug, 'event_type_slug': self.eventtype.slug})) + return super().get(request, *args, **kwargs) + class CombinedProposalSubmitView(LoginRequiredMixin, CampViewMixin, CreateView): """