From 6ce921c24542984c8256bd5a959e5c67e1ce1c2e Mon Sep 17 00:00:00 2001 From: David Kerkeslager Date: Fri, 4 Mar 2022 11:29:22 -0500 Subject: [PATCH] Add user detail view --- src/user_profile/templates/auth/user_detail.html | 5 +++++ src/user_profile/views.py | 9 ++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 src/user_profile/templates/auth/user_detail.html 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() -- 2.20.1