@require_GET
def confirm_change_email(request, activation_key):
 activation_key = activation_key.lower()
 email_change = get_object_or_404(EmailChange, activation_key=activation_key)
 u = email_change.user
 old_email = u.email
 new_email = email_change.email
 duplicate = User.objects.filter(email=new_email).exists()
 if (not duplicate):
  u.email = new_email
  u.save()
 email_change.delete()
 return render(request, 'users/change_email_complete.html', {'old_email': old_email, 'new_email': new_email, 'username': u.username, 'duplicate': duplicate})

@ require_GET def confirm_change_email ( request , activation_key ) : activation_key = activation_key . lower ( ) email_change = get_object_or_404 ( EmailChange , activation_key = activation_key ) u = email_change . user old_email = u . email new_email = email_change . email duplicate = User . objects . filter ( email = new_email ) . exists ( ) if ( not duplicate ) : u . email = new_email u . save ( ) email_change . delete ( ) return render ( request , 'users/change_email_complete.html' , { 'old_email' : old_email , 'new_email' : new_email , 'username' : u . username , 'duplicate' : duplicate } )
confirm the new email for the user .