s/tabs/spaces
This commit is contained in:
1 parent
1c80be7dd9
commit
7ee1bf4453
3 files changed
+69
-51
No files matched your search
@@ -4,3 +4,5 @@ temp
|
||||
*.log
|
||||
settings.py
|
||||
dns_mdb.db
|
||||
/.idea
|
||||
/venv
|
||||
+63
-48
@@ -1,81 +1,96 @@
|
||||
from mdb.models import *
|
||||
from django.contrib import admin
|
||||
|
||||
|
||||
class Ip6AddressInline(admin.TabularInline):
|
||||
model = Ip6Address
|
||||
extra = 0
|
||||
model = Ip6Address
|
||||
extra = 0
|
||||
|
||||
|
||||
class InterfaceInline(admin.TabularInline):
|
||||
inlines = [Ip6AddressInline]
|
||||
model = Interface
|
||||
extra = 0
|
||||
inlines = [Ip6AddressInline]
|
||||
model = Interface
|
||||
extra = 0
|
||||
|
||||
|
||||
class HostAdmin(admin.ModelAdmin):
|
||||
ordering = ('hostname',)
|
||||
inlines = [InterfaceInline]
|
||||
list_display = ['hostname', 'owner', 'host_type', 'location', 'mac_addresses', 'ip_addresses', 'in_domain', 'ipv6_enabled']
|
||||
readonly_fields = ['kerberos_principal_name', 'kerberos_principal_created_date',
|
||||
'kerberos_principal_created']
|
||||
search_fields = ['hostname', 'location', 'interface__macaddr','interface__ip4address__address']
|
||||
fieldsets = (
|
||||
('Owner Information', {
|
||||
'fields' : ( 'owner', 'location', 'description' )
|
||||
}),
|
||||
('Hardware and Software Information', {
|
||||
'fields' : ( ('brand', 'model'), 'serial_number', ('hostname', 'host_type' ),
|
||||
('operating_system', 'virtual' ) )
|
||||
}),
|
||||
('Domain and Kerberos Information', {
|
||||
'description' : 'If this host is a member of the LDAP domain, you need to tick the request kerberos principal checkbox. A principal will then be created for the host.',
|
||||
'classes' : [ 'collapse' ],
|
||||
'fields' : ( 'request_kerberos_principal', 'kerberos_principal_created',
|
||||
('kerberos_principal_name', 'kerberos_principal_created_date'))
|
||||
}),
|
||||
)
|
||||
ordering = ('hostname',)
|
||||
inlines = [InterfaceInline]
|
||||
list_display = ['hostname', 'owner', 'host_type', 'location', 'mac_addresses', 'ip_addresses', 'in_domain',
|
||||
'ipv6_enabled']
|
||||
readonly_fields = ['kerberos_principal_name', 'kerberos_principal_created_date',
|
||||
'kerberos_principal_created']
|
||||
search_fields = ['hostname', 'location', 'interface__macaddr', 'interface__ip4address__address']
|
||||
fieldsets = (
|
||||
('Owner Information', {
|
||||
'fields': ('owner', 'location', 'description' )
|
||||
}),
|
||||
('Hardware and Software Information', {
|
||||
'fields': (('brand', 'model'), 'serial_number', ('hostname', 'host_type'), ('operating_system', 'virtual'))
|
||||
}),
|
||||
('Domain and Kerberos Information', {
|
||||
'description': 'If this host is a member of the LDAP domain, you need to tick the request kerberos principal checkbox. A principal will then be created for the host.',
|
||||
'classes': ['collapse'],
|
||||
'fields': ('request_kerberos_principal', 'kerberos_principal_created',
|
||||
('kerberos_principal_name', 'kerberos_principal_created_date'))
|
||||
}),
|
||||
)
|
||||
|
||||
|
||||
class Ip4AddressInline(admin.TabularInline):
|
||||
model = Ip4Address
|
||||
extra = 0
|
||||
readonly_fields = ['address']
|
||||
model = Ip4Address
|
||||
extra = 0
|
||||
readonly_fields = ['address']
|
||||
|
||||
|
||||
class DhcpOptionInline(admin.TabularInline):
|
||||
model = DhcpOption
|
||||
extra = 0
|
||||
model = DhcpOption
|
||||
extra = 0
|
||||
|
||||
|
||||
class DhcpCustomFieldInline(admin.TabularInline):
|
||||
model = DhcpCustomField
|
||||
extra = 0
|
||||
model = DhcpCustomField
|
||||
extra = 0
|
||||
|
||||
|
||||
class SubnetAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'network', 'netmask', 'num_addresses', 'broadcast_address', 'first_address', 'last_address']
|
||||
inlines = [DhcpOptionInline,DhcpCustomFieldInline,Ip4AddressInline]
|
||||
list_display = ['name', 'network', 'netmask', 'num_addresses', 'broadcast_address', 'first_address', 'last_address']
|
||||
inlines = [DhcpOptionInline, DhcpCustomFieldInline, Ip4AddressInline]
|
||||
|
||||
|
||||
class DomainSrvRecordInline(admin.TabularInline):
|
||||
model = DomainSrvRecord
|
||||
extra = 0
|
||||
model = DomainSrvRecord
|
||||
extra = 0
|
||||
|
||||
|
||||
class DomainTxtRecordInline(admin.TabularInline):
|
||||
model = DomainTxtRecord
|
||||
extra = 0
|
||||
model = DomainTxtRecord
|
||||
extra = 0
|
||||
|
||||
|
||||
class DomainCnameRecordInline(admin.TabularInline):
|
||||
model = DomainCnameRecord
|
||||
extra = 0
|
||||
model = DomainCnameRecord
|
||||
extra = 0
|
||||
|
||||
|
||||
class DomainARecordInline(admin.TabularInline):
|
||||
model = DomainARecord
|
||||
extra = 0
|
||||
model = DomainARecord
|
||||
extra = 0
|
||||
|
||||
|
||||
class DomainAdmin(admin.ModelAdmin):
|
||||
inlines = [DomainSrvRecordInline, DomainTxtRecordInline, DomainARecordInline, DomainCnameRecordInline]
|
||||
list_display = ['domain_name', 'domain_soa', 'domain_admin', 'num_records', 'domain_ipaddr']
|
||||
search_fields = ['domain_name']
|
||||
inlines = [DomainSrvRecordInline, DomainTxtRecordInline, DomainARecordInline, DomainCnameRecordInline]
|
||||
list_display = ['domain_name', 'domain_soa', 'domain_admin', 'num_records', 'domain_ipaddr']
|
||||
search_fields = ['domain_name']
|
||||
|
||||
|
||||
class HostTypeAdmin(admin.ModelAdmin):
|
||||
list_display = ['host_type', 'description', 'num_members']
|
||||
list_display = ['host_type', 'description', 'num_members']
|
||||
|
||||
|
||||
class OperatingSystemAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'version', 'architecture']
|
||||
list_display = ['name', 'version', 'architecture']
|
||||
|
||||
|
||||
admin.site.register(Domain, DomainAdmin)
|
||||
admin.site.register(Host, HostAdmin)
|
||||
|
||||
@@ -5,9 +5,10 @@ from django.views.generic.base import RedirectView
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', RedirectView.as_view(url='admin/')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
urlpatterns = patterns(
|
||||
'',
|
||||
url(r'^$', RedirectView.as_view(url='admin/')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
Reference in new issue
Block a user