Open the views.py file of the account application and add the following code to it:
from django.shortcuts import get_object_or_404from django.contrib.auth.models import User@login_requireddef user_list(request): users = User.objects.filter(is_active=True) return render(request, 'account/user/list.html', {'section': 'people', 'users': users})@login_requireddef user_detail(request, username): user = get_object_or_404(User, username=username, is_active=True) return render(request, 'account/user/detail.html', {'section': 'people', 'user': user})
These are simple list and detail views for user objects. The user_list view gets all active users. The Django User model contains an is_active flag to ...