💚 Fix linters

This commit is contained in:
Yohann D'ANELLO 2020-08-01 16:07:47 +02:00
parent 377397b319
commit b5586c647b
4 changed files with 13 additions and 14 deletions

View File

@ -5,7 +5,6 @@ from django.contrib import admin
from django.contrib.auth.admin import UserAdmin from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from note.templatetags.pretty_money import pretty_money from note.templatetags.pretty_money import pretty_money
from note_kfet.admin import admin_site from note_kfet.admin import admin_site

View File

@ -132,19 +132,20 @@ class MembershipForm(forms.ModelForm):
'date_start': DatePickerInput(), 'date_start': DatePickerInput(),
} }
class MembershipRolesForm(forms.ModelForm): class MembershipRolesForm(forms.ModelForm):
user = forms.ModelChoiceField( user = forms.ModelChoiceField(
queryset=User.objects, queryset=User.objects,
label=_("User"), label=_("User"),
disabled=True, disabled=True,
widget=Autocomplete( widget=Autocomplete(
User, User,
attrs={ attrs={
'api_url': '/api/user/', 'api_url': '/api/user/',
'name_field': 'username', 'name_field': 'username',
'placeholder': 'Nom ...', 'placeholder': 'Nom ...',
}, },
), ),
) )
roles = forms.ModelMultipleChoiceField( roles = forms.ModelMultipleChoiceField(
@ -154,4 +155,4 @@ class MembershipRolesForm(forms.ModelForm):
class Meta: class Meta:
model = Membership model = Membership
fields = ('user', 'roles') fields = ('user', 'roles')

View File

@ -672,9 +672,9 @@ class ClubMembersListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableV
if 'search' in self.request.GET: if 'search' in self.request.GET:
pattern = self.request.GET['search'] pattern = self.request.GET['search']
qs = qs.filter( qs = qs.filter(
Q(user__first_name__iregex='^' + pattern) | Q(user__first_name__iregex='^' + pattern)
Q(user__last_name__iregex='^' + pattern) | | Q(user__last_name__iregex='^' + pattern)
Q(user__note__alias__normalized_name__iregex='^' + Alias.normalize(pattern)) | Q(user__note__alias__normalized_name__iregex='^' + Alias.normalize(pattern))
) )
only_active = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0' only_active = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0'
@ -706,4 +706,4 @@ class ClubMembersListView(ProtectQuerysetMixin, LoginRequiredMixin, SingleTableV
context["only_active"] = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0' context["only_active"] = "only_active" not in self.request.GET or self.request.GET["only_active"] != '0'
return context return context

View File

@ -39,4 +39,3 @@ class SogeCreditAdmin(admin.ModelAdmin):
def has_add_permission(self, request): def has_add_permission(self, request):
# Don't create a credit manually # Don't create a credit manually
return False return False