Fix amount of \ in apps/activity/views.py

This commit is contained in:
Alexandre Iooss 2020-08-09 19:49:11 +02:00
parent c6e3a57801
commit f6dfbb0b6c
1 changed files with 12 additions and 5 deletions

View File

@ -151,14 +151,21 @@ class ActivityEntryView(LoginRequiredMixin, TemplateView):
first_name=F("note__noteuser__user__first_name"), first_name=F("note__noteuser__user__first_name"),
username=F("note__noteuser__user__username"), username=F("note__noteuser__user__username"),
note_name=F("name"), note_name=F("name"),
balance=F("note__balance"))\ balance=F("note__balance"))
.filter(note__noteuser__isnull=False)\
.filter( # Keep only users that have a note
note_qs = note_qs.filter(note__noteuser__isnull=False)
# Keep only members
note_qs = note_qs.filter(
note__noteuser__user__memberships__club=activity.attendees_club, note__noteuser__user__memberships__club=activity.attendees_club,
note__noteuser__user__memberships__date_start__lte=timezone.now(), note__noteuser__user__memberships__date_start__lte=timezone.now(),
note__noteuser__user__memberships__date_end__gte=timezone.now(), note__noteuser__user__memberships__date_end__gte=timezone.now(),
)\ )
.filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))
# Filter with permission backend
note_qs = note_qs.filter(PermissionBackend.filter_queryset(self.request.user, Alias, "view"))
if pattern: if pattern:
note_qs = note_qs.filter( note_qs = note_qs.filter(
Q(note__noteuser__user__first_name__regex=pattern) Q(note__noteuser__user__first_name__regex=pattern)