From 0bf5067b602ee1e78e3bcf686619f6bb0fad27d5 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 15 Aug 2020 19:10:23 +0200 Subject: [PATCH] Fix linters --- apps/member/views.py | 8 ++++---- apps/note/models/transactions.py | 2 +- apps/wei/management/commands/extract_ml_registrations.py | 1 - 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/apps/member/views.py b/apps/member/views.py index 3375927a..869f060d 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -385,8 +385,8 @@ class ClubDetailView(ProtectQuerysetMixin, LoginRequiredMixin, DetailView): empty_membership = Membership( club=club, user=User.objects.first(), - date_start=datetime.now().date(), - date_end=datetime.now().date(), + date_start=date.today(), + date_end=date.today(), fee=0, ) context["can_add_members"] = PermissionBackend()\ @@ -601,8 +601,8 @@ class ClubAddMemberView(ProtectQuerysetMixin, LoginRequiredMixin, ProtectedCreat if user.note.balance + credit_amount < fee and not Membership.objects.filter( club__name="Kfet", user=user, - date_start__lte=datetime.now().date(), - date_end__gte=datetime.now().date(), + date_start__lte=date.today(), + date_end__gte=date.today(), ).exists(): # Users without a valid Kfet membership can't have a negative balance. # TODO Send a notification to the user (with a mail?) to tell her/him to credit her/his note diff --git a/apps/note/models/transactions.py b/apps/note/models/transactions.py index 461e250d..3d37548e 100644 --- a/apps/note/models/transactions.py +++ b/apps/note/models/transactions.py @@ -1,8 +1,8 @@ # Copyright (C) 2018-2020 by BDE ENS Paris-Saclay # SPDX-License-Identifier: GPL-3.0-or-later + from django.core.exceptions import ValidationError from django.db import models, transaction -from django.db.models import F from django.urls import reverse from django.utils import timezone from django.utils.translation import gettext_lazy as _ diff --git a/apps/wei/management/commands/extract_ml_registrations.py b/apps/wei/management/commands/extract_ml_registrations.py index 6d48093e..9bc82418 100644 --- a/apps/wei/management/commands/extract_ml_registrations.py +++ b/apps/wei/management/commands/extract_ml_registrations.py @@ -5,7 +5,6 @@ from datetime import date from django.core.management import BaseCommand from django.db.models import Q - from member.models import Membership, Club from wei.models import WEIClub