Example #1
0
def keys_change(request, pk):
    key = get_object_or_404(SshPublicKey, pk=pk, user=request.user)

    if request.method == "POST":
        form = SshPublicKeyForm(request.POST, instance=key)
        if form.is_valid():
            key = form.save()
            messages.success(request, _("Key updated."))
            return redirect("accounts_keys_list")
    else:
        form = SshPublicKeyForm(instance=key)

    return render(request, "accounts/keys_change.html", {"form": form, "key": key})
Example #2
0
def keys_add(request):
    if request.method == "POST":
        form = SshPublicKeyForm(request.POST)
        if form.is_valid():
            key = form.save(commit=False)
            key.user = request.user
            key.save()
            messages.success(request, _("Key added."))
            return redirect("accounts_keys_list")
    else:
        form = SshPublicKeyForm()

    return render(request, "accounts/keys_change.html", {"form": form})
Example #3
0
def keys_change(request, pk):
    key = get_object_or_404(SshPublicKey, pk=pk, user=request.user)

    if request.method == 'POST':
        form = SshPublicKeyForm(request.POST, instance=key)
        if form.is_valid():
            key = form.save()
            register_repository_update(key.user, 'key_changed')
            messages.success(request, _('Key updated.'))
            return redirect('accounts_keys_list')
    else:
        form = SshPublicKeyForm(instance=key)

    return render(request, 'accounts/keys_change.html', {'form': form})
Example #4
0
def keys_add(request):
    if request.method == 'POST':
        form = SshPublicKeyForm(request.POST)
        if form.is_valid():
            key = form.save(commit=False)
            key.user = request.user
            key.save()
            register_repository_update(key.user, 'key_added')
            messages.success(request, _('Key added.'))
            return redirect('accounts_keys_list')
    else:
        form = SshPublicKeyForm()

    return render(request, 'accounts/keys_add.html', {'form': form})
Example #5
0
def keys_change(request, pk):
    key = get_object_or_404(SshPublicKey, pk=pk, user=request.user)

    if request.method == 'POST':
        form = SshPublicKeyForm(request.POST, instance=key)
        if form.is_valid():
            key = form.save()
            register_repository_update(key.user, 'key_changed')
            messages.success(request, _('Key updated.'))
            return redirect('accounts_keys_list')
    else:
        form = SshPublicKeyForm(instance=key)

    return render(request, 'accounts/keys_change.html', {'form': form})
Example #6
0
def keys_add(request):
    if request.method == 'POST':
        form = SshPublicKeyForm(request.POST)
        if form.is_valid():
            key = form.save(commit=False)
            key.user = request.user
            key.save()
            register_repository_update(key.user, 'key_added')
            messages.success(request, _('Key added.'))
            return redirect('accounts_keys_list')
    else:
        form = SshPublicKeyForm()

    return render(request, 'accounts/keys_add.html', {'form': form})