def METHOD_NAME(request):
    try:
        token = Token.objects.get(user=request.user)
    except Token.DoesNotExist:
        token = None
    if request.method == "POST":
        if token:
            token.delete()
        token = Token.objects.create(user=request.user)
        return redirect(reverse('settings-api-token'))
    context = {'token': token}
    return render(request, 'squad/user_settings/api_token.jinja2', context)