def createAdmin(email,password,name): ''' Create an admin from the given email and password''' mlogger.debug("Creating admin email = %s " %(email,)) u = User.objects.create_user(email.replace("@","_").replace(".","_"),email) u.set_password(password) u.save() #he is admin save his profile up = UserProfile() up.country = Country.objects.all()[0] up.isadmin = True up.fullname = name up.user = u up.save() incorporateEmailActivation(up) return u
def createMember(name,email,password,type,sform,institute): ''' Create an admin from the given email and password''' mlogger.debug("Creating admin email = %s " %(email,)) u = User.objects.create_user(email.replace("@","_").replace(".","_"),email) u.set_password(password) u.save() #he is admin save his profile up = UserProfile() up.isadmin = False up.user = u if type.lower() == "student": up.isStudent = True else: up.isFaculty = True up.fullname = name up.save() up.institutes.add(institute) incorporateEmailActivation(up) return up