and the associated view: def available(request): """Return the availability status of a desired username. This is used in conjunction with dojo, on the account registration form. """ if not request.POST: return HttpResponseRedirect(ACCOUNT_REGISTER_URL) if request.POST.has_key('xhr'): username = request.POST.get('username', None) response_dict={} response_dict['username'] = username response_dict['available'] = False if User.objects.filter(username=username).count() == 0: response_dict['available']=True return HttpResponse(simplejson.dumps(response_dict), mimetype='application/javascript') else: return HttpResponseRedirect(ACCOUNT_REGISTER_URL)