mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 09:51:22 -06:00
Closes #2766: Extend users admin table to include superuser and active fields
This commit is contained in:
parent
bd74e2f30b
commit
92a2f529e3
@ -6,6 +6,7 @@ v2.5.4 (FUTURE)
|
|||||||
* [#2590](https://github.com/digitalocean/netbox/issues/2590) - Implemented the color picker with Select2 to show colors in the background
|
* [#2590](https://github.com/digitalocean/netbox/issues/2590) - Implemented the color picker with Select2 to show colors in the background
|
||||||
* [#2735](https://github.com/digitalocean/netbox/issues/2735) - Implemented Select2 for all list filter form select elements
|
* [#2735](https://github.com/digitalocean/netbox/issues/2735) - Implemented Select2 for all list filter form select elements
|
||||||
* [#2753](https://github.com/digitalocean/netbox/issues/2753) - Implemented Select2 to replace most all instances of select fields in forms
|
* [#2753](https://github.com/digitalocean/netbox/issues/2753) - Implemented Select2 to replace most all instances of select fields in forms
|
||||||
|
* [#2766](https://github.com/digitalocean/netbox/issues/2766) - Extend users admin table to include superuser and active fields
|
||||||
* [#2782](https://github.com/digitalocean/netbox/issues/2782) - Add `is_pool` field for prefix filtering
|
* [#2782](https://github.com/digitalocean/netbox/issues/2782) - Add `is_pool` field for prefix filtering
|
||||||
|
|
||||||
## Bug Fixes
|
## Bug Fixes
|
||||||
|
@ -1,19 +1,39 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.contrib.auth.admin import UserAdmin as UserAdmin_
|
||||||
|
from django.contrib.auth.models import User
|
||||||
|
|
||||||
from netbox.admin import admin_site
|
from netbox.admin import admin_site
|
||||||
from .models import Token
|
from .models import Token
|
||||||
|
|
||||||
|
|
||||||
|
# Unregister the built-in UserAdmin so that we can use our custom admin view below
|
||||||
|
admin_site.unregister(User)
|
||||||
|
|
||||||
|
|
||||||
|
@admin.register(User, site=admin_site)
|
||||||
|
class UserAdmin(UserAdmin_):
|
||||||
|
list_display = [
|
||||||
|
'username', 'email', 'first_name', 'last_name', 'is_superuser', 'is_staff', 'is_active'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
class TokenAdminForm(forms.ModelForm):
|
class TokenAdminForm(forms.ModelForm):
|
||||||
key = forms.CharField(required=False, help_text="If no key is provided, one will be generated automatically.")
|
key = forms.CharField(
|
||||||
|
required=False,
|
||||||
|
help_text="If no key is provided, one will be generated automatically."
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
fields = ['user', 'key', 'write_enabled', 'expires', 'description']
|
fields = [
|
||||||
|
'user', 'key', 'write_enabled', 'expires', 'description'
|
||||||
|
]
|
||||||
model = Token
|
model = Token
|
||||||
|
|
||||||
|
|
||||||
@admin.register(Token, site=admin_site)
|
@admin.register(Token, site=admin_site)
|
||||||
class TokenAdmin(admin.ModelAdmin):
|
class TokenAdmin(admin.ModelAdmin):
|
||||||
form = TokenAdminForm
|
form = TokenAdminForm
|
||||||
list_display = ['key', 'user', 'created', 'expires', 'write_enabled', 'description']
|
list_display = [
|
||||||
|
'key', 'user', 'created', 'expires', 'write_enabled', 'description'
|
||||||
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user