Queryset for current logged in user Django

前端 未结 4 1582
时光说笑
时光说笑 2021-01-14 06:22

I am doing queryset with my model. Now the queryset is displaying all the data in my html page. But I want to display only the logged in users data.

models.p

4条回答
  •  失恋的感觉
    2021-01-14 07:18

    Below code should work fine.

     {% for data in filter %}
         
  • {{ data.user.username }} - {{ data.user.get_full_name }}
  • {% endfor %} {% for Data in filter %} {{ Data.user }} {{ Data.Date }} {{ Data.Status }} {% empty %}

    As you would not be using filters, so filters.py should be removed.
    This will also not work. Make the changes as required. {{ filter.form.as_table }}

提交回复
热议问题