Exemple #1
0
    def view_profile(self):
        viewer = ScholarUser.by_id(session['user']['id'])
        if 'uid' in request.params:
            profile_owner = ScholarUser.by_id(request.params['uid'])
        else :
            profile_owner = viewer

        if not profile_owner:
            return "Profile not found"
        profile = Profile.by_user_id(profile_owner.id)
        c.profile_owner = profile_owner
        c.profile = profile
        if viewer :
            c.viewer = viewer
        return render("scholar/view_profile.mako")
Exemple #2
0
 def profile_edit(self):
     user = ScholarUser.by_id(session['user']['id'])
     profile = Profile.by_user_id(session['user']['id'])
     if user:
         c.user = user
     if profile:
         c.profile = profile
     return render("/scholar/edit_profile.mako")
Exemple #3
0
    def profile_update(self):
        user = ScholarUser.by_id(session['user']['id'])
        profile = Profile.by_user_id(session['user']['id'])
        
        if 'school' in request.params :
            school = School.by_name(request.params['school'])
            if not school:
                school = create_school(request.params['school'])
            profile.school = school
            profile.school_id = school.id
        if 'major' in request.params :
            profile.major = request.params['major']
        if 'gpa' in request.params : 
            profile.gpa = request.params['gpa']
        if 'hometown' in request.params :
            profile.hometown = request.params['hometown']
        #birthdate
        #race
        #religion
        #activities
        Session.add(profile)
        Session.commit()

        return "Profile updated."