コード例 #1
0
ファイル: schedule.py プロジェクト: benbest86/myewb2
def session_new(request):
    if not request.user.has_module_perms("conference"):
        return HttpResponseRedirect(reverse("conference_schedule"))

    if request.method == "POST":
        form = ConferenceSessionForm(request.POST)

        if form.is_valid():
            session = form.save()
            return HttpResponseRedirect(reverse("conference_session", kwargs={"session": session.id}))
    else:
        form = ConferenceSessionForm()

    return render_to_response(
        "conference/schedule/session_edit.html", {"form": form, "new": True}, context_instance=RequestContext(request)
    )
コード例 #2
0
ファイル: schedule.py プロジェクト: benbest86/myewb2
def session_edit(request, session):
    if not request.user.has_module_perms("conference"):
        return HttpResponseRedirect(reverse("conference_schedule"))

    s = get_object_or_404(ConferenceSession, id=session)

    if request.method == "POST":
        form = ConferenceSessionForm(request.POST, instance=s)

        if form.is_valid():
            session = form.save()
            return HttpResponseRedirect(reverse("conference_session", kwargs={"session": session.id}))
    else:
        form = ConferenceSessionForm(instance=s)

    return render_to_response(
        "conference/schedule/session_edit.html", {"form": form}, context_instance=RequestContext(request)
    )
コード例 #3
0
ファイル: schedule.py プロジェクト: tanveerahmad1517/myewb2
def session_edit(request, session):
    if not request.user.has_module_perms("conference"):
        return HttpResponseRedirect(reverse('conference_schedule'))

    s = get_object_or_404(ConferenceSession, id=session)

    if request.method == 'POST':
        form = ConferenceSessionForm(request.POST, instance=s)

        if form.is_valid():
            session = form.save()
            return HttpResponseRedirect(
                reverse('conference_session', kwargs={'session': session.id}))
    else:
        form = ConferenceSessionForm(instance=s)

    return render_to_response("conference/schedule/session_edit.html",
                              {"form": form},
                              context_instance=RequestContext(request))
コード例 #4
0
ファイル: schedule.py プロジェクト: tanveerahmad1517/myewb2
def session_new(request):
    if not request.user.has_module_perms("conference"):
        return HttpResponseRedirect(reverse('conference_schedule'))

    if request.method == 'POST':
        form = ConferenceSessionForm(request.POST)

        if form.is_valid():
            session = form.save()
            return HttpResponseRedirect(
                reverse('conference_session', kwargs={'session': session.id}))
    else:
        form = ConferenceSessionForm()

    return render_to_response("conference/schedule/session_edit.html", {
        "form": form,
        "new": True
    },
                              context_instance=RequestContext(request))