Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_edit_privacy_group(request):
if request.method == "POST" and request.is_ajax():
id_ = request.POST.get('id', None)
name = request.POST.get('name', None)
description = request.POST.get('description', None)
members = request.POST.get('members', None)
members_can_see = request.POST.get('members_can_see', False)
if members_can_see == "false":
members_can_see = False
members_can_use = request.POST.get('members_can_use', False)
if members_can_use == "false":
members_can_use = False
results = handlers.add_edit_privacy_group(id_=id_,
name=name,
description=description,
members=members,
members_can_see=members_can_see,
members_can_use=members_can_use)
return HttpResponse(json.dumps(results),
content_type="application/json")
else:
return render_to_response('error.html',
{'error': "Must be AJAX."},
RequestContext(request))