Exemplo n.º 1
0
class TagTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn(viewname="extras:tag", args=[Accessor("slug")])
    color = ColorColumn()
    actions = ButtonsColumn(Tag, pk_field="slug")

    class Meta(BaseTable.Meta):
        model = Tag
        fields = ("pk", "name", "items", "slug", "color", "description", "actions")
Exemplo n.º 2
0
class CableTable(StatusTableMixin, BaseTable):
    pk = ToggleColumn()
    id = tables.Column(linkify=True, verbose_name="ID")
    termination_a_parent = tables.TemplateColumn(
        template_code=CABLE_TERMINATION_PARENT,
        accessor=Accessor("termination_a"),
        orderable=False,
        verbose_name="Side A",
    )
    termination_a = tables.LinkColumn(
        accessor=Accessor("termination_a"),
        orderable=False,
        verbose_name="Termination A",
    )
    termination_b_parent = tables.TemplateColumn(
        template_code=CABLE_TERMINATION_PARENT,
        accessor=Accessor("termination_b"),
        orderable=False,
        verbose_name="Side B",
    )
    termination_b = tables.LinkColumn(
        accessor=Accessor("termination_b"),
        orderable=False,
        verbose_name="Termination B",
    )
    length = tables.TemplateColumn(template_code=CABLE_LENGTH, order_by="_abs_length")
    color = ColorColumn()
    tags = TagColumn(url_name="dcim:cable_list")

    class Meta(BaseTable.Meta):
        model = Cable
        fields = (
            "pk",
            "id",
            "label",
            "termination_a_parent",
            "termination_a",
            "termination_b_parent",
            "termination_b",
            "status",
            "type",
            "color",
            "length",
            "tags",
        )
        default_columns = (
            "pk",
            "id",
            "label",
            "termination_a_parent",
            "termination_a",
            "termination_b_parent",
            "termination_b",
            "status",
            "type",
        )
Exemplo n.º 3
0
class StatusTable(BaseTable):
    """Table for list view of `Status` objects."""

    pk = ToggleColumn()
    name = tables.LinkColumn(viewname="extras:status", args=[Accessor("slug")])
    color = ColorColumn()
    actions = ButtonsColumn(Status, pk_field="slug")
    content_types = ContentTypesColumn(truncate_words=15)

    class Meta(BaseTable.Meta):
        model = Status
        fields = ["pk", "name", "slug", "color", "content_types", "description"]
Exemplo n.º 4
0
class RackRoleTable(BaseTable):
    pk = ToggleColumn()
    name = tables.Column(linkify=True)
    rack_count = tables.Column(verbose_name="Racks")
    color = ColorColumn()
    actions = ButtonsColumn(RackRole)

    class Meta(BaseTable.Meta):
        model = RackRole
        fields = ("pk", "name", "rack_count", "color", "description", "slug", "actions")
        default_columns = (
            "pk",
            "name",
            "rack_count",
            "color",
            "description",
            "actions",
        )
Exemplo n.º 5
0
class DeviceRoleTable(BaseTable):
    pk = ToggleColumn()
    name = tables.LinkColumn()
    device_count = LinkedCountColumn(viewname="dcim:device_list",
                                     url_params={"role": "slug"},
                                     verbose_name="Devices")
    vm_count = LinkedCountColumn(
        viewname="virtualization:virtualmachine_list",
        url_params={"role": "slug"},
        verbose_name="VMs",
    )
    color = ColorColumn()
    vm_role = BooleanColumn()
    actions = ButtonsColumn(DeviceRole, pk_field="slug")

    class Meta(BaseTable.Meta):
        model = DeviceRole
        fields = (
            "pk",
            "name",
            "device_count",
            "vm_count",
            "color",
            "vm_role",
            "description",
            "slug",
            "actions",
        )
        default_columns = (
            "pk",
            "name",
            "device_count",
            "vm_count",
            "color",
            "vm_role",
            "description",
            "actions",
        )