mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-21 20:18:38 -06:00
Review tweaks
This commit is contained in:
@@ -26,12 +26,13 @@ __all__ = (
|
||||
|
||||
|
||||
class CableBundleSerializer(PrimaryModelSerializer):
|
||||
cable_count = serializers.IntegerField(read_only=True, default=None)
|
||||
|
||||
class Meta:
|
||||
model = CableBundle
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'name', 'description', 'comments', 'tags',
|
||||
'custom_fields', 'created', 'last_updated',
|
||||
'custom_fields', 'created', 'last_updated', 'cable_count',
|
||||
]
|
||||
brief_fields = ('id', 'url', 'display', 'name', 'description')
|
||||
|
||||
|
||||
@@ -856,7 +856,7 @@ class CableBulkEditForm(PrimaryModelBulkEditForm):
|
||||
|
||||
model = Cable
|
||||
fieldsets = (
|
||||
FieldSet('type', 'status', 'profile', 'tenant', 'label', 'description'),
|
||||
FieldSet('type', 'status', 'profile', 'tenant', 'bundle', 'label', 'description'),
|
||||
FieldSet('color', 'length', 'length_unit', name=_('Attributes')),
|
||||
)
|
||||
nullable_fields = (
|
||||
|
||||
@@ -1179,6 +1179,7 @@ class CableBundleFilterForm(PrimaryModelFilterSetForm):
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('name', name=_('Attributes')),
|
||||
)
|
||||
tag = TagFilterField(model)
|
||||
|
||||
|
||||
class CableFilterForm(TenancyFilterForm, PrimaryModelFilterSetForm):
|
||||
|
||||
@@ -108,7 +108,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
@strawberry_django.filter(models.CableBundle, lookups=True)
|
||||
@strawberry_django.filter_type(models.CableBundle, lookups=True)
|
||||
class CableBundleFilter(PrimaryModelFilter):
|
||||
name: StrFilterLookup[str] | None = strawberry_django.filter_field()
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ class Migration(migrations.Migration):
|
||||
on_delete=django.db.models.deletion.SET_NULL,
|
||||
related_name='cables',
|
||||
to='dcim.cablebundle',
|
||||
verbose_name='bundle',
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -4036,8 +4036,8 @@ class CableBundleView(generic.ObjectView):
|
||||
queryset = CableBundle.objects.all()
|
||||
|
||||
def get_extra_context(self, request, instance):
|
||||
# Not prefetching terminations as they are not included in the default inline table layout. See CableListView
|
||||
# for prefetch pattern if terminations are necessary here.
|
||||
# Not prefetching related cable terminations as they are not included in the default inline CableTable layout.
|
||||
# See CableListView for prefetch pattern if terminations are necessary here.
|
||||
cables_table = tables.CableTable(
|
||||
instance.cables.all(),
|
||||
orderable=False,
|
||||
|
||||
@@ -21,12 +21,6 @@
|
||||
<th scope="row">{% trans "Description" %}</th>
|
||||
<td>{{ object.description|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Cables" %}</th>
|
||||
<td>
|
||||
<a href="{% url 'dcim:cable_list' %}?bundle_id={{ object.pk }}">{{ object.cables.count }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
{% include 'inc/panels/custom_fields.html' %}
|
||||
|
||||
Reference in New Issue
Block a user