Exemple #1
0
def edit_scene(request, scene_id):
  this_scene = get_object_or_404(Scene, pk=scene_id)
  if request.method == 'POST':
    form = SceneForm(request.POST, instance=this_scene)
    if form.is_valid():
      form.save()
      return HttpResponseRedirect('/scene/' + scene_id)
  else:
    form = SceneForm(instance=this_scene)
  return render_to_response('scene/edit.html', {'form':form, 'party':this_scene.party}, context_instance=RequestContext(request))
Exemple #2
0
def add_scene(request, party_id):
  this_party = get_object_or_404(Party, pk=party_id)
  if request.method == 'POST':
    new_scene = Scene.objects.create(party=this_party)
    form = SceneForm(request.POST, instance=new_scene)
    if form.is_valid():
      form.save()
      return HttpResponseRedirect('/party/' + party_id)
  else:
    form = SceneForm()
  return render_to_response('scene/add.html', {'form':form, 'party':this_party}, context_instance=RequestContext(request))