feat: Filter for active ANs first

This commit is contained in:
moanos [he/him] 2024-08-09 07:43:57 +02:00
parent b0a54df82c
commit 5f077edeb6

View File

@ -38,7 +38,7 @@ def fail_if_user_not_owner_or_trust_level(user, django_object, trust_level=User.
def index(request):
"""View function for home page of site."""
latest_adoption_list = AdoptionNotice.objects.order_by("-created_at")[:5]
latest_adoption_list = AdoptionNotice.objects.filter(adoptionnoticestatus__major_status=AdoptionNoticeStatus.ACTIVE).order_by("-created_at")[:5]
active_adoptions = [adoption for adoption in latest_adoption_list if adoption.is_active]
language_code = translation.get_language()
lang = Language.objects.get(languagecode=language_code)