def inset_people(request): global userid if request.POST: post = request.POST id = post["id"] new_salary = Salary(salaryid_id=id, hour=0, plus=0, forfeit=0, sub=0) new_people = People(peopleid=id, name=post["name"], nation=post["nation"], phone=post["phone"], email=post["email"], date=post["date"], address=post["address"], birthday=post["birthday"], ptype_id=Salary_type.objects.get( typename=post["post_name"]).salary_typeid, allsalary=Salary_type.objects.get( typename=post["post_name"]).base_pay) if post["sex"] == "M": new_people.sex = True else: new_people.sex = False new_people.save() new_salary.save() return render_to_response("insert_people.html")
def add_people(request): people = People() people.name = '后羿%d' % random.randrange(100) people.sex = '男' people.save() card = Card() card.num = random.randrange(100000, 200000) card.cid = people card.save() return HttpResponse('添加成功')