PEP8 + typo

This commit is contained in:
Ludovic Stephan 2017-01-19 01:06:09 -02:00
parent c58ac3a904
commit 88aec52141
3 changed files with 95 additions and 90 deletions

View file

@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.shortcuts import render
from django.http import Http404
from django.db.models import Q
@ -11,6 +7,7 @@ from gestioncof.models import User, Clipper
from kfet.decorators import teamkfet_required
from kfet.models import Account
@teamkfet_required
def account_create(request):
if "q" not in request.GET:
@ -32,31 +29,31 @@ def account_create(request):
for word in search_words:
queries['kfet'] = queries['kfet'].filter(
Q(cofprofile__user__username__icontains = word)
| Q(cofprofile__user__first_name__icontains = word)
| Q(cofprofile__user__last_name__icontains = word)
Q(cofprofile__user__username__icontains=word) |
Q(cofprofile__user__first_name__icontains=word) |
Q(cofprofile__user__last_name__icontains=word)
)
queries['users_cof'] = queries['users_cof'].filter(
Q(username__icontains = word)
| Q(first_name__icontains = word)
| Q(last_name__icontains = word)
Q(username__icontains=word) |
Q(first_name__icontains=word) |
Q(last_name__icontains=word)
)
queries['users_notcof'] = queries['users_notcof'].filter(
Q(username__icontains = word)
| Q(first_name__icontains = word)
| Q(last_name__icontains = word)
Q(username__icontains=word) |
Q(first_name__icontains=word) |
Q(last_name__icontains=word)
)
queries['clippers'] = queries['clippers'].filter(
Q(username__icontains = word)
| Q(fullname__icontains = word)
Q(username__icontains=word) |
Q(fullname__icontains=word)
)
queries['kfet'] = queries['kfet'].distinct()
usernames = list( \
usernames = list(
queries['kfet'].values_list('cofprofile__user__username', flat=True))
queries['kfet'] = [ (account, account.cofprofile.user) \
queries['kfet'] = [(account, account.cofprofile.user)
for account in queries['kfet']]
queries['users_cof'] = \
@ -64,9 +61,9 @@ def account_create(request):
queries['users_notcof'] = \
queries['users_notcof'].exclude(username__in=usernames).distinct()
usernames += list( \
usernames += list(
queries['users_cof'].values_list('username', flat=True))
usernames += list( \
usernames += list(
queries['users_notcof'].values_list('username', flat=True))
queries['clippers'] = \

View file

@ -7,7 +7,7 @@
</a>
</li>
{% if kfet %}
<li class="user_category"><span class="text">Comptes existant</span></li>
<li class="user_category"><span class="text">Comptes existants</span></li>
{% for account, user in kfet %}
<li><span class="text">{{ account }} [{{ user|highlight_user:q }}]</span></li>
{% endfor %}

View file

@ -1,9 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import (absolute_import, division,
print_function, unicode_literals)
from builtins import *
from django.conf.urls import url
from django.contrib.auth.decorators import permission_required
from kfet import views
@ -35,13 +31,18 @@ urlpatterns = [
name='kfet.account.create_special'),
url(r'^accounts/new/user/(?P<username>.+)$', views.account_create_ajax,
name='kfet.account.create.fromuser'),
url(r'^accounts/new/clipper/(?P<login_clipper>.+)$', views.account_create_ajax,
url(r'^accounts/new/clipper/(?P<login_clipper>.+)$',
views.account_create_ajax,
name='kfet.account.create.fromclipper'),
url(r'^accounts/new/empty$', views.account_create_ajax,
name='kfet.account.create.empty'),
url(r'^autocomplete/account_new$', autocomplete.account_create,
name='kfet.account.create.autocomplete'),
# Account - Search
url(r'^autocomplete/account_search$', autocomplete.account_search,
name='kfet.account.search.autocomplete'),
# Account - Read
url(r'^accounts/(?P<trigramme>.{3})$', views.account_read,
name='kfet.account.read'),
@ -54,14 +55,17 @@ urlpatterns = [
url(r'^accounts/groups$', views.account_group,
name='kfet.account.group'),
url(r'^accounts/groups/new$',
permission_required('kfet.manage_perms')(views.AccountGroupCreate.as_view()),
permission_required('kfet.manage_perms')
(views.AccountGroupCreate.as_view()),
name='kfet.account.group.create'),
url(r'^accounts/groups/(?P<pk>\d+)/edit$',
permission_required('kfet.manage_perms')(views.AccountGroupUpdate.as_view()),
permission_required('kfet.manage_perms')
(views.AccountGroupUpdate.as_view()),
name='kfet.account.group.update'),
url(r'^accounts/negatives$',
permission_required('kfet.view_negs')(views.AccountNegativeList.as_view()),
permission_required('kfet.view_negs')
(views.AccountNegativeList.as_view()),
name='kfet.account.negative'),
# -----
@ -85,7 +89,9 @@ urlpatterns = [
teamkfet_required(views.CheckoutUpdate.as_view()),
name='kfet.checkout.update'),
### Checkout Statements urls
# -----
# Checkout Statement urls
# -----
# Checkout Statement - General
url('^checkouts/statements/$',
@ -154,10 +160,12 @@ urlpatterns = [
# -----
url(r'^settings/$',
permission_required('kfet.change_settings')(views.SettingsList.as_view()),
permission_required('kfet.change_settings')
(views.SettingsList.as_view()),
name='kfet.settings'),
url(r'^settings/(?P<pk>\d+)/edit$',
permission_required('kfet.change_settings')(views.SettingsUpdate.as_view()),
permission_required('kfet.change_settings')
(views.SettingsUpdate.as_view()),
name='kfet.settings.update'),
# -----