It looks like you just need to reset your 'i' variable to zero within your loop. It's also possible your i+=1 and j+=1 are not indented enough, but that might just be a copy/paste issue.
To debug problems like this, I often add prints and simplify the code as much as possible.
Here's a minimal version of your code that prints i and j instead of drawing things.
(The 'print' below works with python 2.x. Add parentheses on the print line if you're using Python 3)
grid_range = 10
i = 0
j = 0
while (j <= (grid_range * 2)):
# Reset i to 0 after completing each loop below.
i = 0
while (i <= (grid_range * 2)):
# OpenGL calls go here.
print j, i
i += 1
j += 1
Also, for the looping in your example, it's simpler to use a 'for' loop. Something like this should work:
grid_range = 10
for j in range(grid_range * 2 + 1):
for i in range(grid_range * 2 + 1):
# OpenGL calls go here.
print j, i
Here is some extra background on python looping in case it helps:
http://docs.python.org/2/tutorial/controlflow.html
http://wiki.python.org/moin/ForLoop