This commit is contained in:
huzichunjohn 2017-11-02 17:21:58 +00:00 committed by GitHub
commit c6375358e5
3 changed files with 5 additions and 2 deletions

View File

@ -202,7 +202,7 @@ class PrefixFilter(CustomFieldFilterSet, django_filters.FilterSet):
return queryset
try:
query = str(IPNetwork(value).cidr)
return queryset.filter(prefix__net_contained_or_equal=query)
return queryset.filter(prefix__net_contained=query)
except (AddrFormatError, ValueError):
return queryset.none()

View File

@ -492,6 +492,7 @@ class PrefixView(View):
'site', 'vlan', 'role',
).annotate_depth(limit=0)
if child_prefixes:
child_prefix_count = len(child_prefixes)
child_prefixes = add_available_prefixes(prefix.prefix, child_prefixes)
child_prefix_table = tables.PrefixDetailTable(child_prefixes)
if request.user.has_perm('ipam.change_prefix') or request.user.has_perm('ipam.delete_prefix'):
@ -520,6 +521,8 @@ class PrefixView(View):
'bulk_querystring': 'vrf_id={}&within={}'.format(prefix.vrf or '0', prefix.prefix),
'permissions': permissions,
'return_url': prefix.get_absolute_url(),
'bulk_querystring': 'parent={}'.format(prefix.prefix),
'obj_num': child_prefix_count,
})

View File

@ -9,7 +9,7 @@
<div class="checkbox-inline">
<label for="select_all">
<input type="checkbox" id="select_all" name="_all" />
Select <strong>all {{ table.rows|length }} {{ table.data.verbose_name_plural }}</strong> matching query
Select <strong>all {% if obj_num %}{{ obj_num }}{% else %}{{ table.rows|length }}{% endif %} {{ table.data.verbose_name_plural }}</strong> matching query
</label>
</div>
<div class="pull-right">