Added inventory to admin.

This commit is contained in:
Chris Church 2013-03-13 17:57:25 -04:00
parent 22a9aad102
commit 8b0401b924
2 changed files with 12 additions and 0 deletions

View File

@ -5,5 +5,13 @@ from lib.main.models import *
class OrganizationAdmin(admin.ModelAdmin):
list_display = ('name', 'description', 'active')
filter_horizontal = ('users', 'admins', 'projects')
class InventoryAdmin(admin.ModelAdmin):
list_display = ('name', 'description', 'active')
# FIXME: Add the rest of the models...
admin.site.register(Organization, OrganizationAdmin)
admin.site.register(Inventory, InventoryAdmin)

View File

@ -1,5 +1,6 @@
from django.db import models
from django.db.models import CASCADE, SET_NULL, PROTECT
from django.utils.translation import ugettext_lazy as _
# TODO: jobs and events model TBD
# TODO: reporting model TBD
@ -64,6 +65,7 @@ class Inventory(CommonModel):
class Meta:
app_label = 'main'
verbose_name_plural = _('inventories')
organization = models.ForeignKey(Organization, null=True, on_delete=SET_NULL, related_name='inventories')
@ -99,6 +101,7 @@ class VariableData(CommonModel):
class Meta:
app_label = 'main'
verbose_name_plural = _('variable data')
host = models.ForeignKey('Host', null=True, default=None, blank=True, on_delete=CASCADE, related_name='variable_data')
group = models.ForeignKey('Group', null=True, default=None, blank=True, on_delete=CASCADE, related_name='variable_data')
@ -199,6 +202,7 @@ class LaunchJobStatus(CommonModel):
class Meta:
app_label = 'main'
verbose_name_plural = _('launch job statuses')
launch_job = models.ForeignKey('LaunchJob', null=True, on_delete=SET_NULL, related_name='launch_job_statuses')
status = models.IntegerField()