コード例 #1
0
ファイル: views.py プロジェクト: wenlien/PyConTW
def proposal_submit(request):
    if not request.user.is_authenticated():
        return redirect("speaker_dashboard")
    else:
        try:
            speaker_profile = request.user.speaker_profile
        except ObjectDoesNotExist:
            return redirect("speaker_dashboard")
    if not settings.ACCEPTING_PROPOSALS:
        return redirect("speaker_dashboard")
    if request.method == "POST":
        form = ProposalSubmitForm(request.POST)
        if form.is_valid():
            proposal = form.save(commit=False)
            proposal.speaker = speaker_profile
            proposal.save()
            form.save_m2m()
            messages.success(request, "Talk proposal submitted.")
            if "add-speakers" in request.POST:
                return redirect("proposal_speaker_manage", proposal.pk)
            return redirect("speaker_dashboard")
    else:
        language = 1 if request.LANGUAGE_CODE == 'en' else 2
        form = ProposalSubmitForm(initial={'language': language})
    ctx = {
        "form": form,
    }
    ctx = RequestContext(request, ctx)
    return render_to_response("proposals/proposal_submit.html", ctx)
コード例 #2
0
ファイル: views.py プロジェクト: issackelly/symposion
def proposal_submit(request):
    if not request.user.is_authenticated():
        return redirect("speaker_dashboard")
    else:
        try:
            speaker_profile = request.user.speaker_profile
        except ObjectDoesNotExist:
            return redirect("speaker_dashboard")
    if not settings.ACCEPTING_PROPOSALS:
        return redirect("speaker_dashboard")
    if request.method == "POST":
        form = ProposalSubmitForm(request.POST)
        if form.is_valid():
            proposal = form.save(commit=False)
            proposal.speaker = speaker_profile
            proposal.save()
            messages.success(request, "Talk proposal submitted.")
            if "add-speakers" in request.POST:
                return redirect("proposal_speaker_manage", proposal.pk)
            return redirect("speaker_dashboard")
    else:
        form = ProposalSubmitForm()
    ctx = {
        "form": form,
    }
    ctx = RequestContext(request, ctx)
    return render_to_response("proposals/proposal_submit.html", ctx)
コード例 #3
0
ファイル: views.py プロジェクト: kellycreativetech/symposion
def proposal_submit(request):
    if not request.user.is_authenticated():
        return redirect("speaker_dashboard")
    else:
        try:
            speaker_profile = request.user.speaker_profile
        except ObjectDoesNotExist:
            return redirect("speaker_dashboard")
    if request.method == "POST":
        form = ProposalSubmitForm(request.POST)
        if form.is_valid():
            proposal = form.save(commit=False)
            proposal.speaker = speaker_profile
            proposal.save()
            messages.success(request, "Talk proposal submitted.")
            if "add-speakers" in request.POST:
                return redirect("proposal_speaker_manage", proposal.pk)
            return redirect("speaker_dashboard")
    else:
        form = ProposalSubmitForm()
    ctx = {
        "form": form,
    }
    ctx = RequestContext(request, ctx)
    return render_to_response("proposals/proposal_submit.html", ctx)