filter speakerproposals by user, and redirect directly to combined submit view if no existing speakerproposals was found

This commit is contained in:
Thomas Steen Rasmussen 2018-05-20 21:54:36 +02:00
parent 1fb4eb7e28
commit df783168c6

View file

@ -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):
"""