diff --git a/ram/portal/templates/cards/scale.html b/ram/portal/templates/cards/scale.html index c2d8351..b80f1f2 100644 --- a/ram/portal/templates/cards/scale.html +++ b/ram/portal/templates/cards/scale.html @@ -28,7 +28,7 @@
diff --git a/ram/portal/views.py b/ram/portal/views.py index 90594c1..b5f7393 100644 --- a/ram/portal/views.py +++ b/ram/portal/views.py @@ -7,7 +7,7 @@ from django.views import View from django.http import Http404, HttpResponseBadRequest from django.db.utils import OperationalError, ProgrammingError -from django.db.models import Q +from django.db.models import Q, Count from django.shortcuts import render, get_object_or_404, get_list_or_404 from django.core.exceptions import ObjectDoesNotExist from django.core.paginator import Paginator @@ -507,7 +507,9 @@ class Scales(GetData): queryset = Scale.objects.all() def get_data(self, request): - return Scale.objects.all() + return Scale.objects.annotate( + num_items=Count("rollingstock") + ) # .filter(num_items__gt=0) to filter data with no items class Types(GetData): diff --git a/ram/ram/__init__.py b/ram/ram/__init__.py index 07f10a7..db52b91 100644 --- a/ram/ram/__init__.py +++ b/ram/ram/__init__.py @@ -1,4 +1,4 @@ from ram.utils import git_suffix -__version__ = "0.14.1" +__version__ = "0.14.2" __version__ += git_suffix(__file__)