def larp_edit(request, object_id): """ FIXME @param request: @type request: @param object_id: @type object_id: """ aLarp = Larp.objects.get(pk=object_id) if canEditLarp(aLarp,request.user): pass else: return HttpResponseRedirect(aLarp.get_absolute_url()) if request.method == "POST": form = LarpForm(request.POST,instance=aLarp) if form.is_valid(): run=form.save() return HttpResponseRedirect(run.get_absolute_url()) else: form = LarpForm(instance=aLarp) return render_to_response('eventCRUD/larp_edit.html', { 'form':form, 'larp':aLarp }, context_instance=RequestContext(request) )
def larp_add(request): """ FIXME @param request: @type request: """ aLarp = Larp(creator=request.user) if request.method == "POST": form = LarpForm(request.POST, instance=aLarp) if form.is_valid(): larp=form.save() return HttpResponseRedirect(larp.get_absolute_url()) else: form = LarpForm() return render_to_response('eventCRUD/larp_add.html', { 'form':form, }, context_instance=RequestContext(request) )