11👍
✅
There’s nothing wrong with Django. You create a local variable range
in the same scope (by assigning one). For instance range = None
in the very last line of a function makes Python consider an occurrence of range
in the first line of the same function a reference to that local variable. Since it doesn’t have a value assigned at that point, you get an UnboundLocalError
.
Source:stackexchange.com