http://stackoverflow.com/questions/2422055/how-to-check-if-request-get-var-is-none
First, check if the request.GET dict contains a parameter named q:
if request.method == 'GET' and 'q' in request.GET: |
Now ensure the variable has a value:
q = request.GET['q'] | |
if q: | |
# Do processing here |