|
@@ -42,7 +42,7 @@ class AntennaPrefixFilter(admin.SimpleListFilter):
|
|
|
parameter_name = 'prefix'
|
|
|
|
|
|
def lookups(self, request, model_admin):
|
|
|
- resources = AntennaAllocation.actives.filter(active=True).values_list('resource__pk', flat=True)
|
|
|
+ resources = AntennaAllocation.objects.filter(active=True).values_list('resource__pk', flat=True)
|
|
|
prefixes = IPPrefix.objects.filter(ipresource__in=resources).values_list('pk', 'prefix').distinct()
|
|
|
return prefixes
|
|
|
|
|
@@ -52,7 +52,7 @@ class AntennaPrefixFilter(admin.SimpleListFilter):
|
|
|
except TypeError:
|
|
|
pass
|
|
|
else:
|
|
|
- allocations = AntennaAllocation.actives.filter(active=True, resource__prefixes__pk=prefix).values_list('pk', flat=True)
|
|
|
+ allocations = AntennaAllocation.objects.filter(active=True, resource__prefixes__pk=prefix).values_list('pk', flat=True)
|
|
|
queryset = queryset.filter(allocation__in=allocations)
|
|
|
return queryset
|
|
|
|
|
@@ -234,15 +234,15 @@ class ServiceTypeAdmin(admin.ModelAdmin):
|
|
|
|
|
|
|
|
|
class AntennaAdmin(geo_admin.OSMGeoAdmin):
|
|
|
- list_display = ('__str__', 'ip_display')
|
|
|
+ list_display = ('id', 'label', 'ip_display')
|
|
|
inlines = (AntennaAllocationInline,)
|
|
|
list_filter = (
|
|
|
AntennaPrefixFilter,
|
|
|
)
|
|
|
|
|
|
def ip_display(self, obj):
|
|
|
- allocations = obj.allocations(manager='actives').filter(active=True)
|
|
|
- return ', '.join(allocations.values_list('resource__ip', flat=True))
|
|
|
+ allocations = obj.allocations.filter(active=True)
|
|
|
+ return ', '.join(allocations.values_list('resource__ip', flat=True)) or '-'
|
|
|
ip_display.short_description = 'IP'
|
|
|
|
|
|
def get_actions(self, request):
|