Exemplo n.º 1
0
def delete_user():
	phoneno=request.form['phoneno']
	User=Details.objects(phoneno=phoneno).first()
	if User is None:
		return "<h2 style='color:red'>No user match</h2><h5><a href='/delete'>Go back</a></h5>"
	User.delete()
	return "<h2 style='color:red'>Deleted User</h2>"
Exemplo n.º 2
0
def _save_Details(name,group,dept,gender,phone,year):
	
	if Details.objects(phoneno=phone).first() is  None:
		Detail=Details()
		Detail.name=name
		Detail.group=group
		Detail.dept=dept
		Detail.phoneno=phone
		if int(gender) is 1:	
			Detail.gender="Male"
		elif int(gender) is 2:
			Detail.gender="Female"
		else:
			print ("Error. Wrong Gender specified")
		Detail.year=year
		Detail.save()
		return "<h2 style='color:green'> Data Registered. </h2><h5><a href='EnterDetails'>Go back</a></h5>"
	return "<h2 style='color:red'>Error</h2><h2>Possibly a duplicate... </h2><h5><a href='EnterDetails'>Go back</a></h5>"