Unverified Commit 41d4a1de authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Get active members through a manager

parent cf572a45
......@@ -179,7 +179,7 @@ class Registration(models.Model):
limit_choices_to=(Q(user__membership__until__isnull=True) |
name = models.CharField(
from django.utils import timezone
from django.db import models
from django.db.models import Q
from django.core import validators
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
......@@ -10,9 +11,20 @@ from localflavor.generic.models import IBANField
from utils.validators import validate_file_extension
class ActiveMemberManager(models.Manager):
"""Get all active members"""
def get_queryset(self):
return (super().get_queryset()
.filter(Q(user__membership__until__isnull=True) |
class Member(models.Model):
"""This class describes a member"""
objects = models.Manager()
active_members = ActiveMemberManager()
# No longer yearly membership as a type, use expiration date instead.
('computingscience', _('Computing Science')),
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment