def add(self, first, last, email, password, sex, year, month, date, picture=None): ''' Add User ''' user = student_model().set_or_get(email) if user.email: return False else: user.first = first user.last = last user.email = email user.password = password user.sex = sex birth_date = '{0}-{1}-{2}'.format(year, month, date) user.bday = datetime.datetime.strptime(birth_date, "%Y-%m-%d").date() if not picture: user.picture = db.Blob('Static\img\visitor.png') else: user.picture = picture user.activate = False user.put() return True
def add_tutor(self, student_email, tutor_email): user = student_model().find_email(student_email) if not tutor_email in user.tutors: user.tutors.append(tutor_email) user.put() return True return False
def add_tutor(self,student_email,tutor_email): user=student_model().find_email(student_email) if not tutor_email in user.tutors: user.tutors.append(tutor_email) user.put() return True return False
def add_basic_info(self,first,email,password): user = student_model().set_or_get(email) tutor = tutor_model().set_or_get(email) if user.email or tutor.email: return False else: user.first = first user.email=email user.password=password user.activate = True user.put() return True
def add_basic_info(self, first, email, password): user = student_model().set_or_get(email) tutor = tutor_model().set_or_get(email) if user.email or tutor.email: return False else: user.first = first user.email = email user.password = password user.activate = True user.put() return True
def modify(self, first, last, email, password): user = student_model().get_or_insert(email) #Already Exist if user: user.first = first user.last = last user.email = email user.password = password user.put() return True else: return False
def modify(self,first,last,email,password): user=student_model().get_or_insert(email) #Already Exist if user: user.first=first user.last=last user.email=email user.password=password user.put() return True else: return False
def add(self, student, site, event, content, information): student = student_model().get_user(student) student_record = student_records_model() student_record.user = student.key() student_record.recorded = time.time() action = action_model() action.user = student.key() action.site_url = site action.event = event action.content_url = content action.information = information action.type = 'Video' action.recorded = time.time() action.recorded = time.time() action_key = action.put() student_record.action = action_key student_record.put() return True
def add_basic_info(self, name, email, password, university, faculty): tutor = tutor_model().set_or_get(email) user = student_model().set_or_get(email) if tutor.email or user.email: return False else: tutor.email = email tutor.password = password tutor.activate = True tutor.first = name u = university_model() u.name = university u_key = u.put() tutor.university = u_key f = faculty_model() f.name = faculty f_key = f.put() tutor.faculty = f_key tutor.put() return True
def add_basic_info(self, name, email, password, university, faculty): tutor = tutor_model().set_or_get(email) user = student_model().set_or_get(email) if tutor.email or user.email: return False else: tutor.email=email tutor.password=password tutor.activate = True tutor.first = name u = university_model() u.name = university u_key = u.put() tutor.university = u_key f = faculty_model() f.name = faculty f_key = f.put() tutor.faculty = f_key tutor.put() return True
def add(self,first,last,email,password,sex,year,month,date,picture=None): ''' Add User ''' user=student_model().set_or_get(email) if user.email: return False else: user.first=first user.last=last user.email=email user.password=password user.sex=sex birth_date = '{0}-{1}-{2}'.format(year,month,date) user.bday=datetime.datetime.strptime(birth_date,"%Y-%m-%d").date() if not picture: user.picture=db.Blob('Static\img\visitor.png') else: user.picture = picture user.activate = False user.put() return True
def find_tutor(self, tutor_email): return student_model().find_tutor(tutor_email)
def find_last(self,last): return student_model().find_last(last)
def find_all_tutors(self,email): return student_model().find_all_tutors(email)
def find_email(self, email): return student_model().find_email(email)
def find_first(self, first): return student_model().find_name(first)
def remove_tutor(self,student_email,tutor_email): user=student_model().get_or_insert(student_email) tutor=tutor_model().get_or_insert(tutor_email) user.tutors.remove(tutor) user.put()
def get_all_user_by_id(self,user_id): return student_model().get_all_user_by_id(user_id)
def get_student(self,student_id): return student_model().get_user(student_id)
def delete(self,user_id): return student_model().delete(user_id)
def find_key(self,user_id): return student_model().get_user(user_id)
def find_email(self,email): return student_model().find_email(email)
def find_tutor(self,tutor_email): return student_model().find_tutor(tutor_email)
def delete(self, user_id): return student_model().delete(user_id)
def get_all_user_by_id(self, user_id): return student_model().get_all_user_by_id(user_id)
def find_last(self, last): return student_model().find_last(last)
def remove_tutor(self, student_email, tutor_email): user = student_model().get_or_insert(student_email) tutor = tutor_model().get_or_insert(tutor_email) user.tutors.remove(tutor) user.put()
def find_key(self, user_id): return student_model().get_user(user_id)
def find_all_tutors(self, email): return student_model().find_all_tutors(email)
def get_student(self, student_id): return student_model().get_user(student_id)
def find_first(self,first): return student_model().find_name(first)