Skip to content
Snippets Groups Projects
Verified Commit 0896cccf authored by Tom Teichler's avatar Tom Teichler :beers:
Browse files

Use isnull instead Q

parent b501b333
No related branches found
No related tags found
1 merge request!229Add statistics about group to group view
Pipeline #1629 failed
......@@ -6,7 +6,7 @@ from django.contrib.auth.models import Group as DjangoGroup
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.db.models import Q, QuerySet
from django.db.models import QuerySet
from django.forms.widgets import Media
from django.urls import reverse
from django.utils import timezone
......@@ -283,7 +283,7 @@ class Group(ExtensibleModel):
stats['members'] = len(self.members.all())
ages = [person.age for person in self.members.filter(~Q(date_of_birth = None))]
ages = [person.age for person in self.members.filter(date_of_birth__isnull=False)]
if ages:
stats['age_avg'] = sum(ages) / len(ages)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment