def save_profile(email, name, description): p = get_user_profile(email) if p: p.name = name p.description = description else: p = UserProfile(email=email, name=name, description=description) p.put()
def save_profile(first_name, last_name, email, password, interests, friends): p = UserProfile(first_name=first_name, last_name=last_name, email=email, password=password, interests=interests, friends=friends) # if p: # p.name = name # p.description = description # else: # p = UserProfile(email=email, name=name, description=description) p.put()
def save_profile(email, name, description): # Before we save the profile, we should make sure the "name" isn't used. p = get_profile_by_name(name) if p and p.email != email: return "Profile name in use.\n" p = get_user_profile(email) if p: p.name = name p.description = description else: p = UserProfile(email=email, name=name, description=description) p.put() return None
def save_profile(email, firstname, lastname, age, description, nationality, location, language, nickname, profilepic): p = get_user_profile(email) if p: p.firstname = firstname p.lastname = lastname p.age = age p.description = description p.nationality = nationality p.location = location p.language = language p.nickname = nickname p.profilepic = profilepic else: p = UserProfile(email = email, firstname= firstname, lastname=lastname, description=description, nationality=nationality, location=location, language=language, nickname=nickname ,profilepic=profilepic) p.put() #saves it in the database
def get_user_matches(email): current_profile = get_user_profile(email) matching_profiles = UserProfile.query( UserProfile.email != email, UserProfile.preferences.IN(current_profile.preferences), UserProfile.neighborhood == current_profile.neighborhood) return matching_profiles
def save_profile(firstname, lastname, email, address, city, state, zipcode, country, role): p = get_user_profile(email) print(firstname, lastname, email, address, city, state, zipcode, country, role) if p is not None: p.firstname = firstname p.lastname = lastname p.email = email p.address = address p.city = city p.state = state p.zipcode = zipcode p.country = country p.role = role else: p = UserProfile(firstname = firstname, lastname = lastname, email = email, address = address, city = city, state = state, zipcode = zipcode, country = country, role = role) print(p) p.put()
def save_profile(email, name, preferences, neighborhood, profile_pic): p = get_user_profile(email) if p: p.name = name p.profile_pic = profile_pic if preferences: p.preferences = preferences if neighborhood: p.neighborhood = neighborhood else: p.preferences = [] else: p = UserProfile(email=email, name=name, preferences=preferences, neighborhood=neighborhood, profile_pic=profile_pic) p.put()
def get_recent_profiles(): q = UserProfile.query().order(-UserProfile.last_update) return q.fetch(50)
def get_profile_by_first_name(name): q = UserProfile.query(UserProfile.first_name == name) results = q.fetch(1) for profile in results: return profile return None
def get_user_profile(email): q = UserProfile.query(UserProfile.email == email) results = q.fetch(1) for profile in results: return profile return None
def get_recent_profiles(): #Can use on the feed, to return profiles/videos of recent users q = UserProfile.query().order(-UserProfile.last_update) return q.fetch(50)
def get_user_preferences(email): #ask if thisll work q = UserProfile.query(UserProfile.email == email) results = q.fetch(1) for profile in results: return profile.preferences return None