Ejemplo n.º 1
0
 def get(self):
     p = get_user_email()
     if p:
         values = get_template_parameters()
         profile = data.get_user_profile(p)
         neededlocation = profile.location
         values['image_url'] = '/profilepic?id=' + profile.key.urlsafe()
         expert_profiles = data.get_expert_profiles(neededlocation)
         expert_list = []
         for expert_profile in expert_profiles:
             if InterestsMatch(expert_profile):
                 expert_profile.keyUrl = expert_profile.key.urlsafe()
                 expert_list.append(expert_profile)
         values['available_experts'] = expert_list
         for expert in values['available_experts']:
             values['expimg'] = '/profilepic?id=' + expert.key.urlsafe()
         values['events'] = []
         events_key_list = data.get_user_profile(
             get_user_email()).events_list
         for events_key in events_key_list:
             event = events_key.get()
             values['events'].append(event)
         values['name'] = profile.name
         values['location'] = profile.location
         values['biography'] = profile.biography
         values['interests'] = profile.interests
         render_template(self, 'profilefeed.html', values)
     else:
         self.redirect('/')
Ejemplo n.º 2
0
 def get(self):
     values = get_template_parameters()
     if not get_user_email():
         profile = data.get_user_profile(get_user_email())
         if profile:
             values['name'] = profile.name
     render_template(self, 'gallery.html', values)
Ejemplo n.º 3
0
 def get(self):
     if not get_user_email():
         self.redirect('/')
     else:
         values = get_template_parameters()
         profile = data.get_user_profile(get_user_email())
         if not profile:
             self.redirect('/profile-edit')
         render_template(self, 'add-dog.html', values)
Ejemplo n.º 4
0
 def get(self, dog_id):
     if not get_user_email():
         self.redirect('/')
     else:
         values = get_template_parameters()
         profile = data.get_user_profile(get_user_email())
         dog_key = ndb.Key(urlsafe=dog_id)
         page = self.request.get('page')
         if page:
             page = int(page)
         else:
             page = 1
         dog = dog_key.get()
         values["name"] = dog.name
         values["breed"] = dog.breed
         values["gender"] = dog.gender
         values["age"] = dog.age
         values["size"] = dog.size
         values["social"] = dog.socialLevel
         values["active"] = dog.activityLevel
         values["keyUrl"] = dog_id
         localDogs = data.get_local_dogs(get_user_email(), profile.city,
                                         profile.state)
         values["amountOfDogs"] = math.ceil(len(localDogs) / float(6))
         scoredDogs = []
         for d in localDogs:
             d.score = data.score_dog(dog, d)
             d.keyUrl = d.key.urlsafe()
             d.profile = data.get_user_profile(d.ownerEmail)
             d.profile.keyUrl = d.profile.key.urlsafe()
             scoredDogs.append(d)
         # NEW CHANGES #################
         scoredDogs.sort(key=lambda d: d.score, reverse=True)
         subset = []
         for di in range((page - 1) * 6,
                         min(len(localDogs), ((page - 1) * 6) + 6)):
             subset.append(scoredDogs[di])
         values["matchedDogs"] = subset
         render_template(self, 'view-dog.html', values)
Ejemplo n.º 5
0
 def get(self):
     values = get_template_parameters()
     if not get_user_email():
         self.redirect('/')
     else:
         values = get_template_parameters()
         profile = data.get_user_profile(get_user_email())
         if profile:
             values["name"] = profile.name
             values["email"] = get_user_email()
             values["city"] = profile.city
             values["state"] = profile.state
             values['sex'] = profile.sex
             values['age'] = profile.age
         render_template(self, 'profile-edit.html', values)
Ejemplo n.º 6
0
    def get(self, name):
        values = get_template_parameters()

        profile = data.get_user_profile(data.get_user_email_by_name(name))
        print ">>>>Profile:"
        print profile
        if profile:
            values['image_url'] = '/profilepic?id=' + profile.key.urlsafe()
            values['profileid'] = profile.key.urlsafe()
            values['name'] = profile.name
            values['biography'] = profile.biography
            values['location'] = profile.location
            values['profile_pic'] = profile.profile_pic
            values['interests'] = data.get_user_interests(get_user_email())
            values['interests'] = values['interests'].items()
            values['email'] = get_user_email()
            values['events'] = []
            events_key_list = profile.events_list
            for events_key in events_key_list:
                event = events_key.get()
                values['events'].append(event)
        render_template(self, 'expert-from-student.html', values)
Ejemplo n.º 7
0
    def get(self):
        if not get_user_email():
            self.redirect('/')
        else:
            values = get_template_parameters()
            profile = data.get_user_profile(get_user_email())

            if profile:
                values["name"] = profile.name
                values["email"] = get_user_email()
                values["city"] = profile.city
                values["state"] = profile.state
                values['sex'] = profile.sex
                values['age'] = profile.age
                values['keyUrl'] = profile.key.urlsafe()
                dogs = []
                for dog in profile.dogs:
                    currDog = dog.get()
                    currDog.keyUrl = currDog.key.urlsafe()
                    print(currDog.keyUrl)
                    dogs.append(currDog)
                values['dogs'] = dogs
                #data.populate_dogs()
            render_template(self, 'profile-view.html', values)