mirror of
				https://gitlab.crans.org/bde/nk20
				synced 2025-11-04 09:12:11 +01:00 
			
		
		
		
	Linters
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
# 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
 | 
			
		||||
from django.urls import reverse
 | 
			
		||||
from django.utils import timezone
 | 
			
		||||
@@ -273,7 +273,8 @@ class SpecialTransaction(Transaction):
 | 
			
		||||
    def clean(self):
 | 
			
		||||
        # SpecialTransaction are only possible with NoteSpecial object
 | 
			
		||||
        if self.is_credit() == self.is_debit():
 | 
			
		||||
            raise(ValidationError(_("A special transaction is only possible between a  Note associated to a payment method and a User or a Club")))
 | 
			
		||||
            raise(ValidationError(_("A special transaction is only possible between a"
 | 
			
		||||
                                    " Note associated to a payment method and a User or a Club")))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class MembershipTransaction(Transaction):
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@
 | 
			
		||||
 | 
			
		||||
import datetime
 | 
			
		||||
 | 
			
		||||
from django.conf import settings
 | 
			
		||||
from django.contrib.auth.backends import ModelBackend
 | 
			
		||||
from django.contrib.auth.models import User, AnonymousUser
 | 
			
		||||
from django.contrib.contenttypes.models import ContentType
 | 
			
		||||
@@ -52,9 +53,9 @@ class PermissionBackend(ModelBackend):
 | 
			
		||||
            & Q(mask__rank__lte=get_current_session().get("permission_mask", 0))
 | 
			
		||||
        )
 | 
			
		||||
 | 
			
		||||
        try:
 | 
			
		||||
        if settings.DATABASES[qs.db]["ENGINE"] == 'django.db.backends.postgresql_psycopg2':
 | 
			
		||||
            qs = qs.distinct('pk', 'club')
 | 
			
		||||
        except:  # SQLite doesn't support distinct fields.
 | 
			
		||||
        else:  # SQLite doesn't support distinct fields.
 | 
			
		||||
            qs = qs.distinct()
 | 
			
		||||
        return qs
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@
 | 
			
		||||
from django.core.management import BaseCommand, CommandError
 | 
			
		||||
from django.db.models import Q
 | 
			
		||||
from django.db.models.functions import Lower
 | 
			
		||||
 | 
			
		||||
from wei.models import WEIClub, Bus, BusTeam, WEIMembership
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -65,7 +64,7 @@ class Command(BaseCommand):
 | 
			
		||||
 | 
			
		||||
        if team is not None:
 | 
			
		||||
            qs = qs.filter(team=team if team else None)
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
        sep = options["sep"]
 | 
			
		||||
 | 
			
		||||
        self.stdout.write("Nom|Prénom|Date de naissance|Genre|Département|Année|Section|Bus|Équipe|Rôles"
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user