22.2.4 Public Profile

As opposed to the ProfileDetail page, the PublicProfileDetail webpage shows the profiles of other users, meaning that we use the slug field on the Profile model to find the Profile and then display it. The PublicProfileDetail webpage is thus simple, because the view is just a DetailView subclass, as you can see in Example 22.19.

Example 22.19: Project Code

user/views.py in a1d420b17a

134   class PublicProfileDetail(DetailView): 135       model = Profile

The URL is also exactly what you’d expect, as you can see in Example 22.20.

Example 22.20: Project Code

user/urls.py in a1d420b17a

 10   from .views import (  11       ActivateAccount, CreateAccount,  12       DisableAccount, ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.