def submit(request): try: if (request.POST['pp']): p = Party.objects.get(name=request.POST['pp']) p.delete() except: pass prof = request.POST['prof'] mmult = {'r_holder':2,'gardener':1,'tmaker':.5} #create a new party partyz = Party(name=request.POST["p_name"], money=5000*mmult[prof], pace = float(request.POST['pace']),rations = float(request.POST['ration'])) partyz.save() inv = Store(name="inventory", isVendor=False, price_mult=1) inv.save() w = Wagon(party=partyz, inventory=inv, weight=0) w.save() print w #create player pp = Character(name=request.POST['player'], profession=request.POST['prof'], status = 1, health = 1, isLeader = True, party = partyz) pp.save() #create members for q in ['m1','m2','m3']: if request.POST[q]: m= Character(name=request.POST[q], profession = "", status = 1, health = 1, isLeader = False, party = partyz) m.save() return HttpResponse("data received. visit <a href='../config.php?p="+str(partyz.id)+"'>config.php</a> to see your party.")