def new_user(self, first_name, last_name, email, password, is_verified, is_premium): user = Student(first_name=first_name, last_name=last_name, email=email, password=password, is_verified=is_verified, is_premium=is_premium) user.save() return user
def create_student(*, account: Account, firstname: str, lastname: str, dateofbirth: str, gender: str, **kwargs) -> Student: student_account_check(account) if student_exist(account.id, raise_exception=False): raise InvalidInputFormat( "Account {} already has a student.".format(account.id)) profile_picture = None if gender.lower() == "male": profile_picture = 'profile/student_default_male.jpg' elif gender.lower() == "female": profile_picture = 'profile/student_default_female.jpg' else: profile_picture = 'profile/student_default_male.jpg' print("Gender {} ???".format(gender)) s = Student(account=account, firstname=firstname, lastname=lastname, dateofbirth=dateofbirth, gender=gender, profile_picture=profile_picture, **kwargs) s.save() return s