def some_view(request):
    foobar = False
if request.GET.get('foobar'):
    foobar = True
return render(request, 'some_template.html', {'foobar': foobar})
How to check if a name/value pair exists when posting data?