I have the following code:
company = Company.objects.filter(account=self.account).only('slug')
if company:
return redirect(reverse_lazy('company:detail_a', kwargs={'slug': company.slug}))
I get the error:
'QuerySet' object has no attribute 'slug'
The slug attribute definitely exist(checked in model/database). I tried to access it like in a template.
So I tried with other attributes, 'name', because appears when I print the QuerySet.
So I think the QuerySet is not evaluated or something like that, but I don't know how to force to do it.