Esempio n. 1
0
    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
Esempio n. 2
0
 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
Esempio n. 3
0
	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
Esempio n. 4
0
	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
Esempio n. 5
0
 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
Esempio n. 6
0
 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
Esempio n. 7
0
	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
Esempio n. 9
0
    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
Esempio n. 10
0
	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
Esempio n. 11
0
	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
Esempio n. 12
0
 def find_tutor(self, tutor_email):
     return student_model().find_tutor(tutor_email)
Esempio n. 13
0
	def find_last(self,last):
		return student_model().find_last(last)
Esempio n. 14
0
	def find_all_tutors(self,email):        
		return student_model().find_all_tutors(email)        
Esempio n. 15
0
 def find_email(self, email):
     return student_model().find_email(email)
Esempio n. 16
0
 def find_first(self, first):
     return student_model().find_name(first)
Esempio n. 17
0
	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()
Esempio n. 18
0
	def get_all_user_by_id(self,user_id):
		return student_model().get_all_user_by_id(user_id)
Esempio n. 19
0
	def get_student(self,student_id):
		return student_model().get_user(student_id)
Esempio n. 20
0
	def delete(self,user_id):
		return student_model().delete(user_id)
Esempio n. 21
0
	def find_key(self,user_id):
		return student_model().get_user(user_id)
Esempio n. 22
0
	def find_email(self,email):
		return student_model().find_email(email)
Esempio n. 23
0
	def find_tutor(self,tutor_email):
		return student_model().find_tutor(tutor_email)     
Esempio n. 24
0
 def delete(self, user_id):
     return student_model().delete(user_id)
Esempio n. 25
0
 def get_all_user_by_id(self, user_id):
     return student_model().get_all_user_by_id(user_id)
Esempio n. 26
0
 def find_last(self, last):
     return student_model().find_last(last)
Esempio n. 27
0
 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()
Esempio n. 28
0
 def find_key(self, user_id):
     return student_model().get_user(user_id)
Esempio n. 29
0
 def find_all_tutors(self, email):
     return student_model().find_all_tutors(email)
Esempio n. 30
0
 def get_student(self, student_id):
     return student_model().get_user(student_id)
Esempio n. 31
0
	def find_first(self,first):
		return student_model().find_name(first)