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) )
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) )
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))
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))