Answer the question
In order to leave comments, you need to log in
I'm making a site on Django, I need to make separate pages for each user. How can this be implemented?
I'm building a Django website using allauth . Faced with the fact that it is necessary to make separate pages for each user.
from django.urls import path
from .views import *
urlpatterns = [
path('user/<int:pk>/', UserProfile.as_view(), name='user-profle'),
]
from django.shortcuts import render
from django.contrib.auth.models import User
from django.views.generic import DetailView
class UserProfile(DetailView):
model = User
template_name = 'HomePage/user-profile.html'
<h3>{{ object.first_name }} {{ object.last_name }}</h3>
{% if object.is_active %}
<p>Online</p>
{% else %}
<p>Offline</p>
{% endif %}
Page not found (404)
Request Method: GET
Request URL: 127.0.0.1:8000/user/1
Raised by: HomePage.views.UserProfile
No user found matching request
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question