Beispiel #1
0
def add(req):
	empty = []
	username = req.session.get('username','')
	if req.POST:
		post = req.POST
		for i in post.keys():
			if post[i] == '':
				empty.append(i + ' shouldn\'t be empty!')
		if len(empty) == 0:			
			new_people = People(
				student_num = post["student_num"],
				name = post["name"],
				phone = post["phone"],
				email = post["email"],
				QQ = post["QQ"],
				address = post["address"],
				birthday = post["birthday"],
				master = username,
				)
			if post["sex"] == "M":
				new_people.sex = True
			else:
				new_people.sex = False
			new_people.save()
	return render_to_response("add.html",{'empty':empty},context_instance = RequestContext(req))
Beispiel #2
0
def addr_book(request):
    if request.POST:
        post = request.POST
        new_people = People(
            sm = post["sm"],
            name = post["name"],
            birthday = post["birthday"],
            phone = post["phone"],
            qq = post["qq"],
            email = post["email"],
            address = post["address"])    
        if post["sex"] == 'M':
            new_people.sex = True
        else:
            new_people.sex = False       
        new_people.save()
    return render_to_response("address_book.html")        
Beispiel #3
0
def addr_book(request):
    if request.POST:
        post = request.POST
        new_people = People(
            user=request.user,
            name=post["name"],
            number=post["number"],
            phone=post["phone"],
            email=post["email"],
            qq=post["qq"],
            birth=post["birth"],
            address=post["address"],
        )
        if post["sex"] == "M":
            new_people.sex = True
        else:
            new_people.sex = False
        new_people.save()
    return render_to_response("import.html")