Merge lp://staging/~gepatino/ubuntu-accomplishments-web/userprofile_username into lp://staging/ubuntu-accomplishments-web

Proposed by Gabriel Patiño
Status: Merged
Merged at revision: 181
Proposed branch: lp://staging/~gepatino/ubuntu-accomplishments-web/userprofile_username
Merge into: lp://staging/ubuntu-accomplishments-web
Diff against target: 144 lines (+26/-33)
3 files modified
common/utils.py (+1/-0)
gallery/urls.py (+8/-9)
gallery/views.py (+17/-24)
To merge this branch: bzr merge lp://staging/~gepatino/ubuntu-accomplishments-web/userprofile_username
Reviewer Review Type Date Requested Status
ubuntu-accomplishments-web-editor-drivers Pending
Review via email: mp+112258@code.staging.launchpad.net

Description of the change

Now uses UserProfile.username in all trophy pages instead of User.username.

By using django.shortcuts.get_object_or_404, the code to get the UserProfile from the url is simplified, and if the user profile is not found returns a 404, which is not bad for an invalid userprofile.

By doing this, the urls for trophies in gallery/urls.py now works with /w in the username part.

Before this changes, all of these urls where valid:

 - /gallery/trophies/gepatino/all/ - all trophies for gepatino
 - /gallery/trophies/gepatino/ - all trophies for gepatino
 - /gallery/trophies/all/ - all trophies for the logged user
 - /gallery/trophies/ - all trophies for the logged user

The problem with the last two ones is that if no user was logged, it failed to get the UserProfile because request.user was an AnonymousUser, so it didn't make any sense to have those.

Anyway, I left the code to detect if the user from the url is the same as the logged in user, and in that case some messages are different in the response.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches