Beispiel #1
0
    attributes['__init__'] = __init__
    return type('VCTLocalFileForm', (base_class, ), attributes)


if is_installed('firmware'):
    from firmware.admin import BaseImageInline
    from firmware.models import BaseImage
    from firmware.settings import FIRMWARE_BASE_IMAGE_EXTENSIONS

    if vct_settings.VCT_LOCAL_FILES:
        BaseImageInline.form = local_files_form_factory(
            BaseImage, 'image', extensions=FIRMWARE_BASE_IMAGE_EXTENSIONS)

    # Replace node firmware download for "VM manager"
    if vct_settings.VCT_VM_MANAGEMENT:
        insert_change_view_action(Node, vm_management)
        insertattr(Node, 'actions', vm_management)
        node_modeladmin = get_modeladmin(Node)
        old_get_change_view_actions_as_class = node_modeladmin.get_change_view_actions_as_class

        def get_change_view_actions_as_class(self):
            actions = old_get_change_view_actions_as_class()
            return [
                action for action in actions if action.url_name != 'firmware'
            ]

        type(
            node_modeladmin
        ).get_change_view_actions_as_class = get_change_view_actions_as_class

# Slices customization
Beispiel #2
0
    attributes["__init__"] = __init__
    return type("VCTLocalFileForm", (base_class,), attributes)


if is_installed("firmware"):
    from firmware.admin import BaseImageInline
    from firmware.models import BaseImage
    from firmware.settings import FIRMWARE_BASE_IMAGE_EXTENSIONS

    if settings.VCT_LOCAL_FILES:
        BaseImageInline.form = local_files_form_factory(BaseImage, "image", extensions=FIRMWARE_BASE_IMAGE_EXTENSIONS)

    # Replace node firmware download for "VM manager"
    if settings.VCT_VM_MANAGEMENT:
        insert_change_view_action(Node, vm_management)
        insertattr(Node, "actions", vm_management)
        node_modeladmin = get_modeladmin(Node)
        old_get_change_view_actions_as_class = node_modeladmin.get_change_view_actions_as_class

        def get_change_view_actions_as_class(self):
            actions = old_get_change_view_actions_as_class()
            return [action for action in actions if action.url_name != "firmware"]

        type(node_modeladmin).get_change_view_actions_as_class = get_change_view_actions_as_class


# Slices customization
if settings.VCT_LOCAL_FILES:
    TemplateAdmin.form = local_files_form_factory(
        Template, "image", extensions=slices_settings.SLICES_TEMPLATE_IMAGE_EXTENSIONS
Beispiel #3
0
from controller.admin.utils import insert_change_view_action
from nodes.models import Node

from .actions import show_node_slivers_journal


insert_change_view_action(Node, show_node_slivers_journal)
Beispiel #4
0
from controller.admin.utils import insert_change_view_action
from nodes.models import Node

from .actions import show_node_slivers_journal

insert_change_view_action(Node, show_node_slivers_journal)