Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

322
Views
Django. How display only loggedin user comments?

I want display comments from loggedin user, I tried this:

{% for c in request.user.game.comment_set.all %}
....
{% endfor %}

but doesn't work.

@edit.

Example:

User1 have comment1, comment2, User2 have comment3. so if I log in to User1 account, I want see only comment1, comment2

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

The easiest way is to find user's comments in view and then pass them into your template.

views.py

user_comments = Comment.objects.filter(user=request.user)
return render(request, 'your_template.html', {'comments': user_comments)

your_template.html

{% for comment in comments %}
   {{ comment.message }}
{% endfor %}
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!