def review_terms(request, url):
 group = get_object_or_404(Group, url=url)
 if (not group.terms):
  return redirect(reverse('groups:show_group', args=[group.url]))
 membership = get_object_or_404(GroupMembership, group=group, userprofile=request.user.userprofile, status=GroupMembership.PENDING_TERMS)
 membership_form = forms.TermsReviewForm((request.POST or None))
 if membership_form.is_valid():
  if (membership_form.cleaned_data['terms_accepted'] == 'True'):
   group.add_member(request.user.userprofile, GroupMembership.MEMBER)
  else:
   membership.delete()
  return redirect(reverse('groups:show_group', args=[group.url]))
 ctx = {'group': group, 'membership_form': membership_form}
 return render(request, 'groups/terms.html', ctx)

def review_terms ( request , url ) : group = get_object_or_404 ( Group , url = url ) if ( not group . terms ) : return redirect ( reverse ( 'groups:show_group' , args = [ group . url ] ) ) membership = get_object_or_404 ( GroupMembership , group = group , userprofile = request . user . userprofile , status = GroupMembership . PENDING_TERMS ) membership_form = forms . TermsReviewForm ( ( request . POST or None ) ) if membership_form . is_valid ( ) : if ( membership_form . cleaned_data [ 'terms_accepted' ] == 'True' ) : group . add_member ( request . user . userprofile , GroupMembership . MEMBER ) else : membership . delete ( ) return redirect ( reverse ( 'groups:show_group' , args = [ group . url ] ) ) ctx = { 'group' : group , 'membership_form' : membership_form } return render ( request , 'groups/terms.html' , ctx )
review group terms page .