mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Initial multitenancy implementation
This commit is contained in:
23
netbox/tenancy/admin.py
Normal file
23
netbox/tenancy/admin.py
Normal file
@ -0,0 +1,23 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import Tenant, TenantGroup
|
||||
|
||||
|
||||
@admin.register(TenantGroup)
|
||||
class TenantGroupAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields = {
|
||||
'slug': ['name'],
|
||||
}
|
||||
list_display = ['name', 'slug']
|
||||
|
||||
|
||||
@admin.register(Tenant)
|
||||
class TenantAdmin(admin.ModelAdmin):
|
||||
prepopulated_fields = {
|
||||
'slug': ['name'],
|
||||
}
|
||||
list_display = ['name', 'slug', 'group']
|
||||
|
||||
def get_queryset(self, request):
|
||||
qs = super(TenantAdmin, self).get_queryset(request)
|
||||
return qs.select_related('group')
|
Reference in New Issue
Block a user