From: David Kerkeslager Date: Fri, 4 Mar 2022 16:29:22 +0000 (-0500) Subject: Add user detail view X-Git-Url: https://code.kerkeslager.com/?a=commitdiff_plain;h=6ce921c24542984c8256bd5a959e5c67e1ce1c2e;p=climbing.kerkeslager.com Add user detail view --- diff --git a/src/user_profile/templates/auth/user_detail.html b/src/user_profile/templates/auth/user_detail.html new file mode 100644 index 0000000..1ff382b --- /dev/null +++ b/src/user_profile/templates/auth/user_detail.html @@ -0,0 +1,5 @@ +{% extends 'core/base.html' %} + +{% block content %} +{{ object.username }} +{% endblock %} diff --git a/src/user_profile/views.py b/src/user_profile/views.py index 408880e..41498b6 100644 --- a/src/user_profile/views.py +++ b/src/user_profile/views.py @@ -1,8 +1,11 @@ +from django.contrib.auth.models import User +from django.shortcuts import get_object_or_404 from django.views.generic.detail import DetailView -from . import models - class UserProfileDetailView(DetailView): - model = models.UserProfile + model = User + + def get_object(self): + return get_object_or_404(User, username=self.kwargs['username']) user_profile_detail = UserProfileDetailView.as_view()