Hi,
I am using the django_filters to filtering the information. However, it is showing the data of all logged user of my systems. I need show only the data of logged user.
Follow the files:
filters.py
import django_filters
from apps.requisitos.models import Requisito
class RequisitoFilter(django_filters.FilterSet):
class Meta:
model = Requisito
fields = ['nomeRequisito', 'projeto']
views.py
class RequisitoList(ListView):
paginate_by = 10
model = Requisito
def get_queryset(self):
usuarioLogado = self.request.user
return Requisito.objects.filter(user=usuarioLogado)
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['filter'] = RequisitoFilter(self.request.GET, queryset=self.queryset)
return context
the loop for of html page
{% for requisito in filter.qs %}
thank you very much