Commits

Anonymous committed c2e8c1e

If a user tries to view their own profile, but it isn't visible, redirect them to the edit page.

  • Participants
  • Parent commits d523b47

Comments (0)

Files changed (1)

File profiles/views.py

         raise Http404 #Otherwise 404
     if public_profile_field is not None and \
        not getattr(profile_obj, public_profile_field):
-        profile_obj = None
+        if user == request.user: #If the user is trying to view their own (invisible) profile
+            return HttpResponseRedirect(reverse(edit_profile)) #Let them edit.
+        else: #Otherwise return no profile object.
+            profile_obj = None
 
     if extra_context is None:
         extra_context = {}