class TrialSelect(LoginRequiredMixin, generic.FormView):
"""Selector for switch Dynamika accounts"""
login_url = '/admin/login/'
template_name = 'dashboards/trial_selector.html'
def get(self, request, *args, **kwargs):
if request.user.has_perm('access_all_dashboards'):
trials = Trial.objects.all()
else:
trials = Trial.objects.filter(user=request.user)
return render(request, self.template_name, {'trials': trials})