Skip to content
Advertisement

How to solve local variable error with forloop in django?

Info: I want to get data from context. The context data is coming from for loop function.

Problem: I am getting this UnboundLocalError local variable 'context' referenced before assignment

JavaScript

Advertisement

Answer

You should do something like this :

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement