@ajax_required
def legal_agreement(request):
 pending_pages = LegalPage.objects.pending_user_agreement(request.user)
 form_class = agreement_form_factory(pending_pages, request.user)
 if (request.method == 'POST'):
  form = form_class(request.POST)
  if form.is_valid():
   form.save()
   return JsonResponse({})
  rendered_form = _get_rendered_agreement(request, form)
  return JsonResponseBadRequest({'form': rendered_form})
 rendered_form = _get_rendered_agreement(request, form_class())
 return JsonResponse({'form': rendered_form})

@ ajax_required def legal_agreement ( request ) : pending_pages = LegalPage . objects . pending_user_agreement ( request . user ) form_class = agreement_form_factory ( pending_pages , request . user ) if ( request . method == 'POST' ) : form = form_class ( request . POST ) if form . is_valid ( ) : form . save ( ) return JsonResponse ( { } ) rendered_form = _get_rendered_agreement ( request , form ) return JsonResponseBadRequest ( { 'form' : rendered_form } ) rendered_form = _get_rendered_agreement ( request , form_class ( ) ) return JsonResponse ( { 'form' : rendered_form } )
displays the pending documents to be agreed by the current user .