Generally, a standard project is created with some "factory" configurations, including in the templates section, the django.template.context_processors.request
that provides the globlal variable resquest
.
Not part of your object , in this case, it is not part of the Torneo_ListView
class, so you should not call it from self
.
So things, this code should work.
class Torneo_ListView(ListView):
template_name = 'torneos/torneo_listar.html'
def get_queryset(self, *args, **kwargs):
return Torneo.objects.filter(user=request.user)
Note
It is important that you make sure you have the corresponding processors. Verify in your configuration file settings.py
that you have something similar to this:
TEMPLATES = [
{
# algunas otras opciones
'OPTIONS': {
# Otras opciones
'context_processors': [
# ...
# muchos procesadores....
'django.template.context_processors.request',
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# este debe estar presente
],
},
},
]