|
|
# Import all the models from the application.
|
|
|
from conntrackt.models import *
|
|
|
|
|
|
# Import the administrator application.
|
|
|
# Django imports.
|
|
|
from django.contrib import admin
|
|
|
from django.core.urlresolvers import resolve
|
|
|
|
|
|
# Import resolver used for figuring-out the view being called in custom query
|
|
|
# calls.
|
|
|
from django.core.urlresolvers import resolve
|
|
|
# Application imports.
|
|
|
from .models import Project, Location, Entity, Interface, Communication
|
|
|
|
|
|
|
|
|
class InterfaceInline(admin.StackedInline):
|
|
|
"""
|
|
@@ -24,6 +22,7 @@ class InterfaceInline(admin.StackedInlin
|
|
|
model = Interface
|
|
|
extra = 1
|
|
|
|
|
|
|
|
|
class CommunicationAdmin(admin.ModelAdmin):
|
|
|
"""
|
|
|
Modifies the default admin class for the Communication class. The
|
|
@@ -81,6 +80,7 @@ class CommunicationAdmin(admin.ModelAdmi
|
|
|
# Call the parent's method so it would do any of its magic.
|
|
|
return super(CommunicationAdmin, self).formfield_for_foreignkey(db_field, request, **kwargs)
|
|
|
|
|
|
|
|
|
class EntityAdmin(admin.ModelAdmin):
|
|
|
"""
|
|
|
This class implements the admin view of the entity instances. It adds some
|
|
@@ -97,6 +97,7 @@ class EntityAdmin(admin.ModelAdmin):
|
|
|
# Enable filtering based on project and location.
|
|
|
list_filter = ['project', 'location']
|
|
|
|
|
|
|
|
|
class InterfaceAdmin(admin.ModelAdmin):
|
|
|
"""
|
|
|
This class implements the admin view of the interface instances. It allows
|
|
@@ -112,6 +113,7 @@ class InterfaceAdmin(admin.ModelAdmin):
|
|
|
# Enable filtering based on project and location.
|
|
|
list_filter = ['entity__project', 'entity__location']
|
|
|
|
|
|
|
|
|
# Register our admin classes.
|
|
|
admin.site.register(Project)
|
|
|
admin.site.register(Location)
|