Return list from def2? Django | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Return list from def2? Django

When I run this code an empty list is returned. Any idea why? Is it about async? Should I use async def view1(request): ? Code(short version): Html: button calls view1 Views.py: def view1(request): List = view2() return render(request, template, {'List': List}) def view2(): int = request.COOKIE['int'] List = postgresqlTable.objects.get(pk=int) return List When I put the code from view2 in view1 it works fine.

29th Jan 2021, 9:09 PM
Fu Foy
Fu Foy - avatar
1 Resposta
0
can you share this code with code playground? The indentation has been destroyed, so I donā€™t know whatā€™s going on.
18th Feb 2021, 11:49 PM
Wilbur Jaywright
Wilbur Jaywright - avatar