mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 18:08:38 -06:00
Fixes #1126: Fix error when editing a user key via admin UI
This commit is contained in:
parent
16c582ec7a
commit
9d9de6b2a3
@ -2,7 +2,7 @@ from django.contrib import admin, messages
|
|||||||
from django.shortcuts import redirect, render
|
from django.shortcuts import redirect, render
|
||||||
|
|
||||||
from .forms import ActivateUserKeyForm
|
from .forms import ActivateUserKeyForm
|
||||||
from .models import UserKey, SecretRole, Secret
|
from .models import UserKey
|
||||||
|
|
||||||
|
|
||||||
@admin.register(UserKey)
|
@admin.register(UserKey)
|
||||||
@ -10,7 +10,7 @@ class UserKeyAdmin(admin.ModelAdmin):
|
|||||||
actions = ['activate_selected']
|
actions = ['activate_selected']
|
||||||
list_display = ['user', 'is_filled', 'is_active', 'created']
|
list_display = ['user', 'is_filled', 'is_active', 'created']
|
||||||
fields = ['user', 'public_key', 'is_active', 'last_updated']
|
fields = ['user', 'public_key', 'is_active', 'last_updated']
|
||||||
readonly_fields = ['is_active', 'last_updated']
|
readonly_fields = ['user', 'is_active', 'last_updated']
|
||||||
|
|
||||||
def get_readonly_fields(self, request, obj=None):
|
def get_readonly_fields(self, request, obj=None):
|
||||||
# Don't allow a user to modify an existing public key directly.
|
# Don't allow a user to modify an existing public key directly.
|
||||||
|
Loading…
Reference in New Issue
Block a user