2013-03-14 01:44:54 +04:00
from django . contrib import admin
from django . utils . translation import ugettext_lazy as _
from lib . main . models import *
class OrganizationAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' users ' , ' admins ' , ' projects ' , ' tags ' )
2013-03-14 01:57:25 +04:00
class InventoryAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-14 01:57:25 +04:00
2013-03-15 18:21:56 +04:00
class TagAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , )
class AuditTrailAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class HostAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class GroupAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' parents ' , ' hosts ' , ' tags ' )
2013-03-15 18:21:56 +04:00
class VariableDataAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class CredentialAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class TeamAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' projects ' , ' users ' , ' organization ' , ' tags ' )
2013-03-15 18:21:56 +04:00
class ProjectAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' inventories ' , ' tags ' )
2013-03-15 18:21:56 +04:00
class PermissionAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class LaunchJobAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
class LaunchJobStatusAdmin ( admin . ModelAdmin ) :
list_display = ( ' name ' , ' description ' , ' active ' )
2013-03-15 19:45:14 +04:00
filter_horizontal = ( ' tags ' , )
2013-03-15 18:21:56 +04:00
2013-03-14 01:57:25 +04:00
# FIXME: Add the rest of the models...
2013-03-14 01:44:54 +04:00
admin . site . register ( Organization , OrganizationAdmin )
2013-03-14 01:57:25 +04:00
admin . site . register ( Inventory , InventoryAdmin )
2013-03-15 18:21:56 +04:00
admin . site . register ( Tag , TagAdmin )
admin . site . register ( AuditTrail , AuditTrailAdmin )
admin . site . register ( Host , HostAdmin )
admin . site . register ( Group , GroupAdmin )
admin . site . register ( VariableData , VariableDataAdmin )
admin . site . register ( Team , TeamAdmin )
admin . site . register ( Project , ProjectAdmin )
admin . site . register ( Credential , CredentialAdmin )
admin . site . register ( LaunchJob , LaunchJobStatusAdmin )
admin . site . register ( LaunchJobStatus , LaunchJobStatusAdmin )