Advertisement
rezamalik15

Untitled

Oct 23rd, 2023
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. file views.py
  2. ==============
  3.  
  4. @login_required
  5. def index(request):
  6. user_active = request.user
  7. all_todos = Todo.objects.all().filter(user = user_active)
  8. return render(request, 'main/index.html', {'todos' : all_todos, 'user' : user_active})
  9.  
  10.  
  11. file main/index.html
  12. ====================
  13.  
  14. <h3 class="">
  15. {{ user.username }}'s Todo List
  16.  
  17. {% if user.is_superuser %}
  18. <a class="btn btn-sm btn-secondary" href="/users/list">
  19. <i class="bi bi-people"></i>
  20. </a>
  21. {% endif %}
  22.  
  23. <a class="btn btn-sm btn-danger" href="/accounts/logout">
  24. <i class="bi bi-box-arrow-right"></i>
  25. </a>
  26. </h3>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement