feat: add method to search active ANs

This commit is contained in:
moanos [he/him] 2025-01-01 19:43:50 +01:00
parent 9d0eed5915
commit 2dbd908f4c

View File

@ -300,6 +300,11 @@ class AdoptionNotice(models.Model):
# returns all subscriptions to that adoption notice # returns all subscriptions to that adoption notice
return Subscriptions.objects.filter(adoption_notice=self) return Subscriptions.objects.filter(adoption_notice=self)
@staticmethod
def get_active_ANs():
active_ans = [an for an in AdoptionNotice.objects.all() if an.is_active]
return active_ans
def get_photos(self): def get_photos(self):
""" """
First trys to get group photos that are attached to the adoption notice if there is none it trys to fetch First trys to get group photos that are attached to the adoption notice if there is none it trys to fetch