mirror of
https://github.com/ansible/awx.git
synced 2026-05-06 08:57:35 -02:30
Admin field/inline updates.
This commit is contained in:
@@ -29,19 +29,48 @@ admin.site.register(User, UserAdmin)
|
|||||||
class OrganizationAdmin(admin.ModelAdmin):
|
class OrganizationAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('name', 'description', 'active')
|
list_display = ('name', 'description', 'active')
|
||||||
|
list_filter = ('active', 'tags')
|
||||||
|
fieldsets = (
|
||||||
|
(None, {'fields': ('name', 'active', 'created_by', 'description',)}),
|
||||||
|
(_('Members'), {'fields': ('users', 'admins',)}),
|
||||||
|
(_('Projects'), {'fields': ('projects',)}),
|
||||||
|
(_('Tags'), {'fields': ('tags',)}),
|
||||||
|
(_('Audit Trail'), {'fields': ('creation_date', 'audit_trail',)}),
|
||||||
|
)
|
||||||
|
readonly_fields = ('creation_date', 'audit_trail')
|
||||||
filter_horizontal = ('users', 'admins', 'projects', 'tags')
|
filter_horizontal = ('users', 'admins', 'projects', 'tags')
|
||||||
|
|
||||||
|
class InventoryHostInline(admin.StackedInline):
|
||||||
|
|
||||||
|
model = Host
|
||||||
|
extra = 0
|
||||||
|
fields = ('name', 'description', 'active', 'tags')
|
||||||
|
filter_horizontal = ('tags',)
|
||||||
|
|
||||||
|
class InventoryGroupInline(admin.StackedInline):
|
||||||
|
|
||||||
|
model = Group
|
||||||
|
extra = 0
|
||||||
|
fields = ('name', 'description', 'active', 'parents', 'hosts', 'tags')
|
||||||
|
filter_horizontal = ('parents', 'hosts', 'tags')
|
||||||
|
|
||||||
class InventoryAdmin(admin.ModelAdmin):
|
class InventoryAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
fields = ('name', 'organization', 'description', 'active', 'tags',
|
|
||||||
'created_by', 'audit_trail')
|
|
||||||
list_display = ('name', 'organization', 'description', 'active')
|
list_display = ('name', 'organization', 'description', 'active')
|
||||||
list_filter = ('organization', 'active')
|
list_filter = ('organization', 'active')
|
||||||
|
fieldsets = (
|
||||||
|
(None, {'fields': ('name', 'organization', 'active', 'created_by',
|
||||||
|
'description',)}),
|
||||||
|
(_('Tags'), {'fields': ('tags',)}),
|
||||||
|
(_('Audit Trail'), {'fields': ('creation_date', 'audit_trail',)}),
|
||||||
|
)
|
||||||
|
readonly_fields = ('creation_date', 'audit_trail')
|
||||||
filter_horizontal = ('tags',)
|
filter_horizontal = ('tags',)
|
||||||
|
inlines = [InventoryHostInline, InventoryGroupInline]
|
||||||
|
|
||||||
class TagAdmin(admin.ModelAdmin):
|
class TagAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('name', )
|
list_display = ('name',)
|
||||||
|
|
||||||
#class AuditTrailAdmin(admin.ModelAdmin):
|
#class AuditTrailAdmin(admin.ModelAdmin):
|
||||||
#
|
#
|
||||||
@@ -49,19 +78,29 @@ class TagAdmin(admin.ModelAdmin):
|
|||||||
# not currently on model, so disabling for now.
|
# not currently on model, so disabling for now.
|
||||||
# filter_horizontal = ('tags',)
|
# filter_horizontal = ('tags',)
|
||||||
|
|
||||||
|
class VariableDataInline(admin.StackedInline):
|
||||||
|
|
||||||
|
model = VariableData
|
||||||
|
extra = 0
|
||||||
|
max_num = 1
|
||||||
|
# FIXME: Doesn't yet work as inline due to the way the OneToOne field is
|
||||||
|
# defined.
|
||||||
|
|
||||||
class HostAdmin(admin.ModelAdmin):
|
class HostAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
fields = ('name', 'inventory', 'description', 'active', 'tags',
|
|
||||||
'created_by', 'audit_trail')
|
|
||||||
list_display = ('name', 'inventory', 'description', 'active')
|
list_display = ('name', 'inventory', 'description', 'active')
|
||||||
list_filter = ('inventory', 'active')
|
list_filter = ('inventory', 'active')
|
||||||
|
fields = ('name', 'inventory', 'description', 'active', 'tags',
|
||||||
|
'created_by', 'audit_trail')
|
||||||
filter_horizontal = ('tags',)
|
filter_horizontal = ('tags',)
|
||||||
# FIXME: Edit reverse of many to many for groups.
|
# FIXME: Edit reverse of many to many for groups.
|
||||||
|
#inlines = [VariableDataInline]
|
||||||
|
|
||||||
class GroupAdmin(admin.ModelAdmin):
|
class GroupAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('name', 'description', 'active')
|
list_display = ('name', 'description', 'active')
|
||||||
filter_horizontal = ('parents', 'hosts', 'tags')
|
filter_horizontal = ('parents', 'hosts', 'tags')
|
||||||
|
#inlines = [VariableDataInline]
|
||||||
|
|
||||||
class VariableDataAdmin(admin.ModelAdmin):
|
class VariableDataAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
@@ -91,12 +130,29 @@ class PermissionAdmin(admin.ModelAdmin):
|
|||||||
class LaunchJobAdmin(admin.ModelAdmin):
|
class LaunchJobAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('name', 'description', 'active')
|
list_display = ('name', 'description', 'active')
|
||||||
|
fieldsets = (
|
||||||
|
(None, {'fields': ('name', 'active', 'created_by', 'description')}),
|
||||||
|
(_('Job Parameters'), {'fields': ('inventory', 'project', 'credential',
|
||||||
|
'user', 'job_type')}),
|
||||||
|
(_('Tags'), {'fields': ('tags',)}),
|
||||||
|
(_('Audit Trail'), {'fields': ('creation_date', 'audit_trail',)}),
|
||||||
|
)
|
||||||
|
readonly_fields = ('creation_date', 'audit_trail')
|
||||||
filter_horizontal = ('tags',)
|
filter_horizontal = ('tags',)
|
||||||
|
|
||||||
|
class LaunchJobStatusEventInline(admin.StackedInline):
|
||||||
|
|
||||||
|
model = LaunchJobStatusEvent
|
||||||
|
extra = 0
|
||||||
|
can_delete = False
|
||||||
|
fields = ('created', 'event', 'event_data')
|
||||||
|
readonly_fields = ('created', 'event', 'event_data')
|
||||||
|
|
||||||
class LaunchJobStatusAdmin(admin.ModelAdmin):
|
class LaunchJobStatusAdmin(admin.ModelAdmin):
|
||||||
|
|
||||||
list_display = ('name', 'description', 'active')
|
list_display = ('name', 'description', 'active', 'status')
|
||||||
filter_horizontal = ('tags',)
|
filter_horizontal = ('tags',)
|
||||||
|
inlines = [LaunchJobStatusEventInline]
|
||||||
|
|
||||||
# FIXME: Add the rest of the models...
|
# FIXME: Add the rest of the models...
|
||||||
|
|
||||||
@@ -110,5 +166,5 @@ admin.site.register(VariableData, VariableDataAdmin)
|
|||||||
admin.site.register(Team, TeamAdmin)
|
admin.site.register(Team, TeamAdmin)
|
||||||
admin.site.register(Project, ProjectAdmin)
|
admin.site.register(Project, ProjectAdmin)
|
||||||
admin.site.register(Credential, CredentialAdmin)
|
admin.site.register(Credential, CredentialAdmin)
|
||||||
admin.site.register(LaunchJob, LaunchJobStatusAdmin)
|
admin.site.register(LaunchJob, LaunchJobAdmin)
|
||||||
admin.site.register(LaunchJobStatus, LaunchJobStatusAdmin)
|
admin.site.register(LaunchJobStatus, LaunchJobStatusAdmin)
|
||||||
|
|||||||
@@ -94,6 +94,14 @@ ul.messagelist li {
|
|||||||
border-color: #b22222 !important;
|
border-color: #b22222 !important;
|
||||||
background-color: #d24242 !important;
|
background-color: #d24242 !important;
|
||||||
}
|
}
|
||||||
|
.errors {
|
||||||
|
background-color: #fdc !important;
|
||||||
|
}
|
||||||
|
.errors input,
|
||||||
|
.errors select,
|
||||||
|
.errors textarea {
|
||||||
|
border: 1px solid #b22222 !important;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user