symposion_app/vendor/symposion/symposion/views.py
Ben Sturmfels 34509d23eb
Make vendored symposion into an installable Python package
This allows us to install with `pip install "-e vendor/symposion"` similar to
the other vendored packages. There's no good reason for this to be different to
the others and depend on PYTHONPATH hacking.

Re-add
2023-04-24 16:38:25 +10:00

16 lines
708 B
Python

from django.contrib.auth.decorators import login_required
from django.shortcuts import render, redirect
from symposion.proposals.models import ProposalSection
@login_required
def dashboard(request):
if request.session.get("pending-token"):
return redirect("speaker_create_token", request.session["pending-token"])
# Patching available proposal kinds into the dashboard to enable creating
# proposals from the dashboard directly.
sections = ProposalSection.available().prefetch_related('section__proposal_kinds')
kinds = [kind for section in sections for kind in section.section.proposal_kinds.all()]
return render(request, "dashboard.html", {'proposal_kinds': kinds})