Some linter setup

This commit is contained in:
Aarni Halinen
2020-06-16 19:18:11 +03:00
parent d3350c06e0
commit ef78ef9dcd
5 changed files with 615 additions and 13 deletions
+2 -6
View File
@@ -3,8 +3,7 @@
from django.db import models
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q, F, OuterRef, Subquery
import csv
from django.db.models import Q, OuterRef, Subquery
class BaseMember(models.Model):
@@ -124,11 +123,8 @@ class Member(BaseMember):
qs = qs.filter(Q(first_name__icontains=term) | Q(last_name__icontains=term))
return qs
@staticmethod
def get_members_with_latest_payment(members_query):
"""Return QuerySet of given members QS with last_paid attribute."""
latest = Payment.objects.filter(member=OuterRef('pk')).order_by('-date')
return members_query.annotate(last_paid=Subquery(latest.values('date')[:1]))
# To avoid problems with a cyclical import, this is at the bottom of the file
from members.forms import MemberForm # nopep8