Commit 2bdd9fbd authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch '484-remove-duplicate-members-registration-admin' into 'master'

List each member only once in Registration admin

Closes #484

See merge request !556
parents 94cbc4be 296e90a7
......@@ -182,4 +182,6 @@ class RegistrationAdmin(DoNextModelAdmin):
if request.GET.get('event_pk'):
kwargs['queryset'] = models.Event.objects.filter(
pk=int(request.GET['event_pk']))
elif db_field.name == 'member':
kwargs['queryset'] = Member.active_members.all()
return super().formfield_for_foreignkey(db_field, request, **kwargs)
......@@ -24,7 +24,8 @@ class ActiveMemberManager(models.Manager):
return (super().get_queryset()
.exclude(user__membership=None)
.filter(Q(user__membership__until__isnull=True) |
Q(user__membership__until__gt=timezone.now().date())))
Q(user__membership__until__gt=timezone.now().date()))
.distinct())
def with_birthdays_in_range(self, from_date, to_date):
queryset = self.get_queryset().filter(birthday__lte=to_date)
......
Markdown is supported
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