Skip to content

Commit

Permalink
Fixes #943: Child prefixes missing on Python 3
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Mar 8, 2017
1 parent 0863405 commit d89314a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion netbox/ipam/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def annotate_depth(self, limit=None):
p.depth = len(stack) - 1
if limit is None:
return queryset
return filter(lambda p: p.depth <= limit, queryset)
return list(filter(lambda p: p.depth <= limit, queryset))


@python_2_unicode_compatible
Expand Down
8 changes: 1 addition & 7 deletions netbox/ipam/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,7 @@ def prefix(request, pk):
duplicate_prefix_table.exclude = ('vrf',)

# Child prefixes table
if prefix.vrf:
# If the prefix is in a VRF, show child prefixes only within that VRF.
child_prefixes = Prefix.objects.filter(vrf=prefix.vrf)
else:
# If the prefix is in the global table, show child prefixes from all VRFs.
child_prefixes = Prefix.objects.all()
child_prefixes = child_prefixes.filter(prefix__net_contained=str(prefix.prefix))\
child_prefixes = Prefix.objects.filter(vrf=prefix.vrf, prefix__net_contained=str(prefix.prefix))\
.select_related('site', 'role').annotate_depth(limit=0)
if child_prefixes:
child_prefixes = add_available_prefixes(prefix.prefix, child_prefixes)
Expand Down

0 comments on commit d89314a

Please sign in to comment.