From 475f1adec57ae2206d19a5bd49effee9433d2a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 6 Jan 2018 12:23:24 +0100 Subject: [PATCH 1/5] Remove "coding: utf8" line --- bda/admin.py | 2 -- bda/algorithm.py | 2 -- bda/autocomplete_light_registry.py | 2 -- bda/forms.py | 2 -- bda/management/commands/manage_reventes.py | 2 -- bda/management/commands/sendrappels.py | 2 -- bda/models.py | 2 -- bda/urls.py | 2 -- bda/views.py | 2 -- cof/locale/fr/formats.py | 2 -- cof/settings/common.py | 1 - cof/urls.py | 2 -- gestioncof/autocomplete.py | 2 -- gestioncof/autocomplete_light_registry.py | 2 -- gestioncof/csv_views.py | 2 -- gestioncof/decorators.py | 2 -- gestioncof/management/commands/syncmails.py | 1 - gestioncof/petits_cours_forms.py | 2 -- gestioncof/petits_cours_models.py | 2 -- gestioncof/petits_cours_views.py | 2 -- gestioncof/templatetags/utils.py | 2 -- gestioncof/tests.py | 1 - gestioncof/urls.py | 2 -- gestioncof/widgets.py | 2 -- kfet/apps.py | 2 -- kfet/auth/backends.py | 1 - kfet/auth/middleware.py | 1 - kfet/auth/tests.py | 1 - kfet/autocomplete.py | 2 -- kfet/config.py | 2 -- kfet/consumers.py | 2 -- kfet/context_processors.py | 2 -- kfet/decorators.py | 2 -- kfet/forms.py | 2 -- kfet/models.py | 2 -- kfet/routing.py | 2 -- kfet/statistic.py | 2 -- kfet/templatetags/kfet_tags.py | 2 -- kfet/tests/test_config.py | 2 -- kfet/tests/test_statistic.py | 2 -- kfet/urls.py | 2 -- kfet/views.py | 2 -- 42 files changed, 78 deletions(-) diff --git a/bda/admin.py b/bda/admin.py index 60d3c1ba..4736ce2d 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import autocomplete_light from datetime import timedelta from custommail.shortcuts import send_mass_custom_mail diff --git a/bda/algorithm.py b/bda/algorithm.py index 7f18ce18..7d6ab2f0 100644 --- a/bda/algorithm.py +++ b/bda/algorithm.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/bda/autocomplete_light_registry.py b/bda/autocomplete_light_registry.py index 6c2f3ea6..774e5c2b 100644 --- a/bda/autocomplete_light_registry.py +++ b/bda/autocomplete_light_registry.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/bda/forms.py b/bda/forms.py index c0417d1e..3b0dd5bd 100644 --- a/bda/forms.py +++ b/bda/forms.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django import forms from django.forms.models import BaseInlineFormSet from django.utils import timezone diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index 0302ec4b..f5dee265 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ Gestion en ligne de commande des reventes. """ diff --git a/bda/management/commands/sendrappels.py b/bda/management/commands/sendrappels.py index 88cf9d5c..8fbdb31c 100644 --- a/bda/management/commands/sendrappels.py +++ b/bda/management/commands/sendrappels.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ Gestion en ligne de commande des mails de rappel. """ diff --git a/bda/models.py b/bda/models.py index 41462d70..42c3b3ef 100644 --- a/bda/models.py +++ b/bda/models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import calendar import random from datetime import timedelta diff --git a/bda/urls.py b/bda/urls.py index 876c84ea..52e74a67 100644 --- a/bda/urls.py +++ b/bda/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/bda/views.py b/bda/views.py index 84b6c9d3..7109443a 100644 --- a/bda/views.py +++ b/bda/views.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from collections import defaultdict import random import hashlib diff --git a/cof/locale/fr/formats.py b/cof/locale/fr/formats.py index 710fa6ed..ec63d8cc 100644 --- a/cof/locale/fr/formats.py +++ b/cof/locale/fr/formats.py @@ -1,5 +1,3 @@ -# -*- encoding: utf-8 -*- - """ Formats français. """ diff --git a/cof/settings/common.py b/cof/settings/common.py index a2ea3f5e..4c573d95 100644 --- a/cof/settings/common.py +++ b/cof/settings/common.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Django common settings for cof project. diff --git a/cof/urls.py b/cof/urls.py index f62d5f01..4599d332 100644 --- a/cof/urls.py +++ b/cof/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - """ Fichier principal de configuration des urls du projet GestioCOF """ diff --git a/gestioncof/autocomplete.py b/gestioncof/autocomplete.py index 968398fd..1d60cd78 100644 --- a/gestioncof/autocomplete.py +++ b/gestioncof/autocomplete.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from ldap3 import Connection from django import shortcuts diff --git a/gestioncof/autocomplete_light_registry.py b/gestioncof/autocomplete_light_registry.py index 4c62d995..6e04022f 100644 --- a/gestioncof/autocomplete_light_registry.py +++ b/gestioncof/autocomplete_light_registry.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import autocomplete_light from django.contrib.auth.models import User diff --git a/gestioncof/csv_views.py b/gestioncof/csv_views.py index c1d82aca..a4f3c028 100644 --- a/gestioncof/csv_views.py +++ b/gestioncof/csv_views.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/gestioncof/decorators.py b/gestioncof/decorators.py index a1263ce3..3875b77d 100644 --- a/gestioncof/decorators.py +++ b/gestioncof/decorators.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.contrib.auth.decorators import user_passes_test diff --git a/gestioncof/management/commands/syncmails.py b/gestioncof/management/commands/syncmails.py index 1d3dddb8..ba61dcf4 100644 --- a/gestioncof/management/commands/syncmails.py +++ b/gestioncof/management/commands/syncmails.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ Import des mails de GestioCOF dans la base de donnée """ diff --git a/gestioncof/petits_cours_forms.py b/gestioncof/petits_cours_forms.py index dfb7a263..c0770afc 100644 --- a/gestioncof/petits_cours_forms.py +++ b/gestioncof/petits_cours_forms.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from captcha.fields import ReCaptchaField from django import forms diff --git a/gestioncof/petits_cours_models.py b/gestioncof/petits_cours_models.py index d9ea9668..06199a01 100644 --- a/gestioncof/petits_cours_models.py +++ b/gestioncof/petits_cours_models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from functools import reduce from django.db import models diff --git a/gestioncof/petits_cours_views.py b/gestioncof/petits_cours_views.py index 087c9cef..5854a927 100644 --- a/gestioncof/petits_cours_views.py +++ b/gestioncof/petits_cours_views.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import json from datetime import datetime from custommail.shortcuts import render_custom_mail diff --git a/gestioncof/templatetags/utils.py b/gestioncof/templatetags/utils.py index 76bc6003..5afd8cfa 100644 --- a/gestioncof/templatetags/utils.py +++ b/gestioncof/templatetags/utils.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/gestioncof/tests.py b/gestioncof/tests.py index 66043daf..f99b0fcb 100644 --- a/gestioncof/tests.py +++ b/gestioncof/tests.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- """ This file demonstrates writing tests using the unittest module. These will pass when you run "manage.py test". diff --git a/gestioncof/urls.py b/gestioncof/urls.py index 57c2e8f2..02814673 100644 --- a/gestioncof/urls.py +++ b/gestioncof/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.conf.urls import url from gestioncof.petits_cours_views import DemandeListView, DemandeDetailView from gestioncof import views, petits_cours_views diff --git a/gestioncof/widgets.py b/gestioncof/widgets.py index 758fc4ad..a44e93b0 100644 --- a/gestioncof/widgets.py +++ b/gestioncof/widgets.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import division from __future__ import print_function from __future__ import unicode_literals diff --git a/kfet/apps.py b/kfet/apps.py index 4f114c37..a18dd905 100644 --- a/kfet/apps.py +++ b/kfet/apps.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * diff --git a/kfet/auth/backends.py b/kfet/auth/backends.py index c6ad21b2..d8ef3001 100644 --- a/kfet/auth/backends.py +++ b/kfet/auth/backends.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.contrib.auth import get_user_model from kfet.models import Account, GenericTeamToken diff --git a/kfet/auth/middleware.py b/kfet/auth/middleware.py index 748ce4dd..388be4fc 100644 --- a/kfet/auth/middleware.py +++ b/kfet/auth/middleware.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from django.contrib.auth import get_user_model from .backends import AccountBackend diff --git a/kfet/auth/tests.py b/kfet/auth/tests.py index c2f183cd..3a61daa2 100644 --- a/kfet/auth/tests.py +++ b/kfet/auth/tests.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from unittest import mock from django.core import signing diff --git a/kfet/autocomplete.py b/kfet/autocomplete.py index c4886180..0d1904d6 100644 --- a/kfet/autocomplete.py +++ b/kfet/autocomplete.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from ldap3 import Connection from django.shortcuts import render from django.http import Http404 diff --git a/kfet/config.py b/kfet/config.py index 76da5a79..f248b370 100644 --- a/kfet/config.py +++ b/kfet/config.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.core.exceptions import ValidationError from django.db import models diff --git a/kfet/consumers.py b/kfet/consumers.py index 0f447d2d..a53bbb72 100644 --- a/kfet/consumers.py +++ b/kfet/consumers.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from .utils import DjangoJsonWebsocketConsumer, PermConsumerMixin diff --git a/kfet/context_processors.py b/kfet/context_processors.py index 04feec81..89678f62 100644 --- a/kfet/context_processors.py +++ b/kfet/context_processors.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from kfet.config import kfet_config diff --git a/kfet/decorators.py b/kfet/decorators.py index 0c8a1a76..66c9d71c 100644 --- a/kfet/decorators.py +++ b/kfet/decorators.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.contrib.auth.decorators import user_passes_test diff --git a/kfet/forms.py b/kfet/forms.py index 963e4254..5cfef918 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from datetime import timedelta from decimal import Decimal diff --git a/kfet/models.py b/kfet/models.py index b1e351d5..08ca4490 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.db import models from django.core.urlresolvers import reverse from django.core.validators import RegexValidator diff --git a/kfet/routing.py b/kfet/routing.py index 54de69ae..f1305d4b 100644 --- a/kfet/routing.py +++ b/kfet/routing.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from channels.routing import include, route_class from . import consumers diff --git a/kfet/statistic.py b/kfet/statistic.py index 3f32807e..0aba4dda 100644 --- a/kfet/statistic.py +++ b/kfet/statistic.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from datetime import date, datetime, time, timedelta from dateutil.relativedelta import relativedelta diff --git a/kfet/templatetags/kfet_tags.py b/kfet/templatetags/kfet_tags.py index f5cd3848..68b74738 100644 --- a/kfet/templatetags/kfet_tags.py +++ b/kfet/templatetags/kfet_tags.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import re from django import template diff --git a/kfet/tests/test_config.py b/kfet/tests/test_config.py index 03c9cf3c..43497ca8 100644 --- a/kfet/tests/test_config.py +++ b/kfet/tests/test_config.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from decimal import Decimal from django.test import TestCase diff --git a/kfet/tests/test_statistic.py b/kfet/tests/test_statistic.py index d8db7ec8..93de27a0 100644 --- a/kfet/tests/test_statistic.py +++ b/kfet/tests/test_statistic.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from unittest.mock import patch from django.test import TestCase, Client diff --git a/kfet/urls.py b/kfet/urls.py index f39299a5..96fd4ddf 100644 --- a/kfet/urls.py +++ b/kfet/urls.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - from django.conf.urls import include, url from django.contrib.auth.decorators import permission_required diff --git a/kfet/views.py b/kfet/views.py index f1dd6834..5c52637d 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -1,5 +1,3 @@ -# -*- coding: utf-8 -*- - import ast from urllib.parse import urlencode From 57411ab46f9da69f0f8d392f6b08785f878d98a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 6 Jan 2018 12:32:42 +0100 Subject: [PATCH 2/5] Remove __future__ imports --- bda/algorithm.py | 4 ---- bda/autocomplete_light_registry.py | 4 ---- bda/management/commands/manage_reventes.py | 2 -- bda/management/commands/sendrappels.py | 2 -- bda/urls.py | 4 ---- cof/locale/fr/formats.py | 2 -- gestioncof/csv_views.py | 4 ---- gestioncof/templatetags/utils.py | 4 ---- gestioncof/tests.py | 4 ---- gestioncof/widgets.py | 4 ---- kfet/apps.py | 2 -- requirements.txt | 1 - 12 files changed, 37 deletions(-) diff --git a/bda/algorithm.py b/bda/algorithm.py index 7d6ab2f0..f0f48ad9 100644 --- a/bda/algorithm.py +++ b/bda/algorithm.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.db.models import Max import random diff --git a/bda/autocomplete_light_registry.py b/bda/autocomplete_light_registry.py index 774e5c2b..7aa43b07 100644 --- a/bda/autocomplete_light_registry.py +++ b/bda/autocomplete_light_registry.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import autocomplete_light from bda.models import Participant, Spectacle diff --git a/bda/management/commands/manage_reventes.py b/bda/management/commands/manage_reventes.py index f5dee265..23bb7ae6 100644 --- a/bda/management/commands/manage_reventes.py +++ b/bda/management/commands/manage_reventes.py @@ -2,8 +2,6 @@ Gestion en ligne de commande des reventes. """ -from __future__ import unicode_literals - from datetime import timedelta from django.core.management import BaseCommand from django.utils import timezone diff --git a/bda/management/commands/sendrappels.py b/bda/management/commands/sendrappels.py index 8fbdb31c..82889f80 100644 --- a/bda/management/commands/sendrappels.py +++ b/bda/management/commands/sendrappels.py @@ -2,8 +2,6 @@ Gestion en ligne de commande des mails de rappel. """ -from __future__ import unicode_literals - from datetime import timedelta from django.core.management.base import BaseCommand from django.utils import timezone diff --git a/bda/urls.py b/bda/urls.py index 52e74a67..8a27fed0 100644 --- a/bda/urls.py +++ b/bda/urls.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.conf.urls import url from gestioncof.decorators import buro_required from bda.views import SpectacleListView diff --git a/cof/locale/fr/formats.py b/cof/locale/fr/formats.py index ec63d8cc..4b47ce3d 100644 --- a/cof/locale/fr/formats.py +++ b/cof/locale/fr/formats.py @@ -2,6 +2,4 @@ Formats français. """ -from __future__ import unicode_literals - DATETIME_FORMAT = r'l j F Y \à H:i' diff --git a/gestioncof/csv_views.py b/gestioncof/csv_views.py index a4f3c028..733768dc 100644 --- a/gestioncof/csv_views.py +++ b/gestioncof/csv_views.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - import csv from django.http import HttpResponse, HttpResponseForbidden from django.template.defaultfilters import slugify diff --git a/gestioncof/templatetags/utils.py b/gestioncof/templatetags/utils.py index 5afd8cfa..2b732aec 100644 --- a/gestioncof/templatetags/utils.py +++ b/gestioncof/templatetags/utils.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django import template from django.utils.safestring import mark_safe diff --git a/gestioncof/tests.py b/gestioncof/tests.py index f99b0fcb..85673edd 100644 --- a/gestioncof/tests.py +++ b/gestioncof/tests.py @@ -5,10 +5,6 @@ when you run "manage.py test". Replace this with more appropriate tests for your application. """ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.test import TestCase from gestioncof.models import CofProfile, User diff --git a/gestioncof/widgets.py b/gestioncof/widgets.py index a44e93b0..134ddd80 100644 --- a/gestioncof/widgets.py +++ b/gestioncof/widgets.py @@ -1,7 +1,3 @@ -from __future__ import division -from __future__ import print_function -from __future__ import unicode_literals - from django.forms.widgets import Widget from django.forms.utils import flatatt from django.utils.safestring import mark_safe diff --git a/kfet/apps.py b/kfet/apps.py index a18dd905..8d8170e9 100644 --- a/kfet/apps.py +++ b/kfet/apps.py @@ -1,5 +1,3 @@ -from __future__ import (absolute_import, division, - print_function, unicode_literals) from builtins import * from django.apps import AppConfig diff --git a/requirements.txt b/requirements.txt index 1591656d..c9c6c4c0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ asgiref==1.1.1 daphne==1.3.0 asgi-redis==1.3.0 statistics==1.0.3.5 -future==0.15.2 django-widget-tweaks==1.4.1 git+https://git.eleves.ens.fr/cof-geek/django_custommail.git#egg=django_custommail ldap3 From 97eed06b6fdd1e808e5add5200a52ae8429cd8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 6 Jan 2018 12:33:30 +0100 Subject: [PATCH 3/5] Remove builtins imports --- kfet/apps.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/kfet/apps.py b/kfet/apps.py index 8d8170e9..7a6c97a2 100644 --- a/kfet/apps.py +++ b/kfet/apps.py @@ -1,7 +1,6 @@ -from builtins import * - from django.apps import AppConfig + class KFetConfig(AppConfig): name = 'kfet' verbose_name = "Application K-Fêt" From 62d8c2ffaf765e1af33767eb6aa8e85ad4cc019a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20P=C3=A9pin?= Date: Sat, 6 Jan 2018 12:37:00 +0100 Subject: [PATCH 4/5] remove @py2_unicode_compat + six --- kfet/models.py | 8 +++----- requirements.txt | 1 - 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/kfet/models.py b/kfet/models.py index 08ca4490..4d30d719 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -1,11 +1,11 @@ +from functools import reduce + from django.db import models from django.core.urlresolvers import reverse from django.core.validators import RegexValidator from django.contrib.auth.models import User from gestioncof.models import CofProfile -from django.utils.six.moves import reduce from django.utils import timezone -from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from django.db import transaction from django.db.models import F @@ -370,7 +370,7 @@ class CheckoutTransfer(models.Model): amount = models.DecimalField( max_digits = 6, decimal_places = 2) -@python_2_unicode_compatible + class CheckoutStatement(models.Model): by = models.ForeignKey( Account, on_delete = models.PROTECT, @@ -439,7 +439,6 @@ class CheckoutStatement(models.Model): super(CheckoutStatement, self).save(*args, **kwargs) -@python_2_unicode_compatible class ArticleCategory(models.Model): name = models.CharField("nom", max_length=45) has_addcost = models.BooleanField("majorée", default=True, @@ -452,7 +451,6 @@ class ArticleCategory(models.Model): return self.name -@python_2_unicode_compatible class Article(models.Model): name = models.CharField("nom", max_length = 45) is_sold = models.BooleanField("en vente", default = True) diff --git a/requirements.txt b/requirements.txt index c9c6c4c0..914eca1c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,6 @@ django-recaptcha==1.0.5 django-redis-cache==1.7.1 psycopg2 Pillow==3.3.0 -six==1.10.0 unicodecsv==0.14.1 icalendar==3.10 django-bootstrap-form==3.2.1 From 42e762bc4a07cde8eee2a9e12ef9e51ce1b75322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Delobelle?= Date: Tue, 16 Jan 2018 16:22:52 +0100 Subject: [PATCH 5/5] Py3 allows to shorten super() --- bda/admin.py | 2 +- bda/forms.py | 8 ++++---- bda/views.py | 2 +- gestioncof/admin.py | 4 ++-- gestioncof/forms.py | 28 +++++++++++++------------- gestioncof/petits_cours_forms.py | 4 ++-- gestioncof/petits_cours_views.py | 2 +- gestioncof/widgets.py | 2 +- kfet/forms.py | 20 +++++++++---------- kfet/models.py | 8 ++++---- kfet/views.py | 34 ++++++++++++++++---------------- 11 files changed, 57 insertions(+), 57 deletions(-) diff --git a/bda/admin.py b/bda/admin.py index 0e796f57..5511cf85 100644 --- a/bda/admin.py +++ b/bda/admin.py @@ -164,7 +164,7 @@ class AttributionAdminForm(forms.ModelForm): ) def clean(self): - cleaned_data = super(AttributionAdminForm, self).clean() + cleaned_data = super().clean() participant = cleaned_data.get("participant") spectacle = cleaned_data.get("spectacle") if participant and spectacle: diff --git a/bda/forms.py b/bda/forms.py index 3b0dd5bd..a363c36e 100644 --- a/bda/forms.py +++ b/bda/forms.py @@ -52,7 +52,7 @@ class ResellForm(forms.Form): required=False) def __init__(self, participant, *args, **kwargs): - super(ResellForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['attributions'].queryset = ( participant.attribution_set .filter(spectacle__date__gte=timezone.now()) @@ -70,7 +70,7 @@ class AnnulForm(forms.Form): required=False) def __init__(self, participant, *args, **kwargs): - super(AnnulForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['attributions'].queryset = ( participant.attribution_set .filter(spectacle__date__gte=timezone.now(), @@ -89,7 +89,7 @@ class InscriptionReventeForm(forms.Form): required=False) def __init__(self, tirage, *args, **kwargs): - super(InscriptionReventeForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['spectacles'].queryset = ( tirage.spectacle_set .select_related('location') @@ -104,7 +104,7 @@ class SoldForm(forms.Form): widget=forms.CheckboxSelectMultiple) def __init__(self, participant, *args, **kwargs): - super(SoldForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['attributions'].queryset = ( participant.attribution_set .filter(revente__isnull=False, diff --git a/bda/views.py b/bda/views.py index 4d18a043..dace3c51 100644 --- a/bda/views.py +++ b/bda/views.py @@ -628,7 +628,7 @@ class SpectacleListView(ListView): return categories def get_context_data(self, **kwargs): - context = super(SpectacleListView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['tirage_id'] = self.tirage.id context['tirage_name'] = self.tirage.title return context diff --git a/gestioncof/admin.py b/gestioncof/admin.py index 51969822..54a6a5a0 100644 --- a/gestioncof/admin.py +++ b/gestioncof/admin.py @@ -181,7 +181,7 @@ class UserProfileAdmin(UserAdmin): def get_fieldsets(self, request, user=None): if not request.user.is_superuser: return self.staff_fieldsets - return super(UserProfileAdmin, self).get_fieldsets(request, user) + return super().get_fieldsets(request, user) def save_model(self, request, user, form, change): cof_group, created = Group.objects.get_or_create(name='COF') @@ -267,7 +267,7 @@ class PetitCoursDemandeAdmin(admin.ModelAdmin): class ClubAdminForm(forms.ModelForm): def clean(self): - cleaned_data = super(ClubAdminForm, self).clean() + cleaned_data = super().clean() respos = cleaned_data.get('respos') members = cleaned_data.get('membres') for respo in respos.all(): diff --git a/gestioncof/forms.py b/gestioncof/forms.py index 2124b7c8..0d1db499 100644 --- a/gestioncof/forms.py +++ b/gestioncof/forms.py @@ -18,7 +18,7 @@ class EventForm(forms.Form): event = kwargs.pop("event") self.event = event current_choices = kwargs.pop("current_choices", None) - super(EventForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) choices = {} if current_choices: for choice in current_choices.all(): @@ -60,7 +60,7 @@ class SurveyForm(forms.Form): def __init__(self, *args, **kwargs): survey = kwargs.pop("survey") current_answers = kwargs.pop("current_answers", None) - super(SurveyForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) answers = {} if current_answers: for answer in current_answers.all(): @@ -100,7 +100,7 @@ class SurveyForm(forms.Form): class SurveyStatusFilterForm(forms.Form): def __init__(self, *args, **kwargs): survey = kwargs.pop("survey") - super(SurveyStatusFilterForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) for question in survey.questions.all(): for answer in question.answers.all(): name = "question_%d_answer_%d" % (question.id, answer.id) @@ -129,7 +129,7 @@ class SurveyStatusFilterForm(forms.Form): class EventStatusFilterForm(forms.Form): def __init__(self, *args, **kwargs): event = kwargs.pop("event") - super(EventStatusFilterForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) for option in event.options.all(): for choice in option.choices.all(): name = "option_%d_choice_%d" % (option.id, choice.id) @@ -175,12 +175,12 @@ class UserProfileForm(forms.ModelForm): last_name = forms.CharField(label=_('Nom'), max_length=30) def __init__(self, *args, **kw): - super(UserProfileForm, self).__init__(*args, **kw) + super().__init__(*args, **kw) self.fields['first_name'].initial = self.instance.user.first_name self.fields['last_name'].initial = self.instance.user.last_name def save(self, *args, **kw): - super(UserProfileForm, self).save(*args, **kw) + super().save(*args, **kw) self.instance.user.first_name = self.cleaned_data.get('first_name') self.instance.user.last_name = self.cleaned_data.get('last_name') self.instance.user.save() @@ -193,7 +193,7 @@ class UserProfileForm(forms.ModelForm): class RegistrationUserForm(forms.ModelForm): def __init__(self, *args, **kw): - super(RegistrationUserForm, self).__init__(*args, **kw) + super().__init__(*args, **kw) self.fields['username'].help_text = "" class Meta: @@ -219,8 +219,7 @@ class RegistrationPassUserForm(RegistrationUserForm): return pass2 def save(self, commit=True, *args, **kwargs): - user = super(RegistrationPassUserForm, self).save(commit, *args, - **kwargs) + user = super().save(commit, *args, **kwargs) user.set_password(self.cleaned_data['password2']) if commit: user.save() @@ -229,7 +228,7 @@ class RegistrationPassUserForm(RegistrationUserForm): class RegistrationProfileForm(forms.ModelForm): def __init__(self, *args, **kw): - super(RegistrationProfileForm, self).__init__(*args, **kw) + super().__init__(*args, **kw) self.fields['mailing_cof'].initial = True self.fields['mailing_bda'].initial = True self.fields['mailing_bda_revente'].initial = True @@ -274,7 +273,7 @@ class AdminEventForm(forms.Form): kwargs["initial"] = {"status": "wait"} else: kwargs["initial"] = {"status": "no"} - super(AdminEventForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) choices = {} for choice in current_choices: if choice.event_option.id not in choices: @@ -337,14 +336,15 @@ class BaseEventRegistrationFormset(BaseFormSet): self.events = kwargs.pop('events') self.current_registrations = kwargs.pop('current_registrations', None) self.extra = len(self.events) - super(BaseEventRegistrationFormset, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) def _construct_form(self, index, **kwargs): kwargs['event'] = self.events[index] if self.current_registrations is not None: kwargs['current_registration'] = self.current_registrations[index] - return super(BaseEventRegistrationFormset, self)._construct_form( - index, **kwargs) + return super()._construct_form(index, **kwargs) + + EventFormset = formset_factory(AdminEventForm, BaseEventRegistrationFormset) diff --git a/gestioncof/petits_cours_forms.py b/gestioncof/petits_cours_forms.py index c0770afc..e8f067bf 100644 --- a/gestioncof/petits_cours_forms.py +++ b/gestioncof/petits_cours_forms.py @@ -10,7 +10,7 @@ from gestioncof.petits_cours_models import PetitCoursDemande, PetitCoursAbility class BaseMatieresFormSet(BaseInlineFormSet): def clean(self): - super(BaseMatieresFormSet, self).clean() + super().clean() if any(self.errors): # Don't bother validating the formset unless each form is # valid on its own @@ -34,7 +34,7 @@ class DemandeForm(ModelForm): captcha = ReCaptchaField(attrs={'theme': 'clean', 'lang': 'fr'}) def __init__(self, *args, **kwargs): - super(DemandeForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['matieres'].help_text = '' class Meta: diff --git a/gestioncof/petits_cours_views.py b/gestioncof/petits_cours_views.py index ec3d1a58..6b8c8610 100644 --- a/gestioncof/petits_cours_views.py +++ b/gestioncof/petits_cours_views.py @@ -42,7 +42,7 @@ class DemandeDetailView(DetailView): context_object_name = "demande" def get_context_data(self, **kwargs): - context = super(DemandeDetailView, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) obj = self.object context['attributions'] = obj.petitcoursattribution_set.all() return context diff --git a/gestioncof/widgets.py b/gestioncof/widgets.py index 134ddd80..1741cfec 100644 --- a/gestioncof/widgets.py +++ b/gestioncof/widgets.py @@ -5,7 +5,7 @@ from django.utils.safestring import mark_safe class TriStateCheckbox(Widget): def __init__(self, attrs=None, choices=()): - super(TriStateCheckbox, self).__init__(attrs) + super().__init__(attrs) # choices can be any iterable, but we may need to render this widget # multiple times. Thus, collapse it into a list so it can be consumed # more than once. diff --git a/kfet/forms.py b/kfet/forms.py index 5cfef918..417a51a7 100644 --- a/kfet/forms.py +++ b/kfet/forms.py @@ -42,7 +42,7 @@ class AccountForm(forms.ModelForm): # Surcharge pour passer data à Account.save() def save(self, data = {}, *args, **kwargs): - obj = super(AccountForm, self).save(commit = False, *args, **kwargs) + obj = super().save(commit = False, *args, **kwargs) obj.save(data = data) return obj @@ -91,7 +91,7 @@ class AccountPwdForm(forms.Form): raise ValidationError("Mot de passe trop court") if pwd1 != pwd2: raise ValidationError("Les mots de passes sont différents") - super(AccountPwdForm, self).clean() + super().clean() class CofForm(forms.ModelForm): def clean_is_cof(self): @@ -195,7 +195,7 @@ class CheckoutStatementCreateForm(forms.ModelForm): or self.cleaned_data['balance_200'] is None or self.cleaned_data['balance_500'] is None): raise ValidationError("Y'a un problème. Si tu comptes la caisse, mets au moins des 0 stp (et t'as pas idée de comment c'est long de vérifier que t'as mis des valeurs de partout...)") - super(CheckoutStatementCreateForm, self).clean() + super().clean() class CheckoutStatementUpdateForm(forms.ModelForm): class Meta: @@ -236,7 +236,7 @@ class ArticleForm(forms.ModelForm): required = False) def __init__(self, *args, **kwargs): - super(ArticleForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if self.instance.pk: self.initial['suppliers'] = self.instance.suppliers.values_list('pk', flat=True) @@ -250,7 +250,7 @@ class ArticleForm(forms.ModelForm): category, _ = ArticleCategory.objects.get_or_create(name=category_new) self.cleaned_data['category'] = category - super(ArticleForm, self).clean() + super().clean() class Meta: model = Article @@ -321,7 +321,7 @@ class KPsulOperationForm(forms.ModelForm): } def clean(self): - super(KPsulOperationForm, self).clean() + super().clean() type_ope = self.cleaned_data.get('type') amount = self.cleaned_data.get('amount') article = self.cleaned_data.get('article') @@ -364,7 +364,7 @@ class AddcostForm(forms.Form): raise ValidationError('Compte invalide') else: self.cleaned_data['amount'] = 0 - super(AddcostForm, self).clean() + super().clean() # ----- @@ -462,7 +462,7 @@ class InventoryArticleForm(forms.Form): stock_new = forms.IntegerField(required=False) def __init__(self, *args, **kwargs): - super(InventoryArticleForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if 'initial' in kwargs: self.name = kwargs['initial']['name'] self.stock_old = kwargs['initial']['stock_old'] @@ -484,7 +484,7 @@ class OrderArticleForm(forms.Form): quantity_ordered = forms.IntegerField(required=False) def __init__(self, *args, **kwargs): - super(OrderArticleForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if 'initial' in kwargs: self.name = kwargs['initial']['name'] self.stock = kwargs['initial']['stock'] @@ -514,7 +514,7 @@ class OrderArticleToInventoryForm(forms.Form): quantity_received = forms.IntegerField() def __init__(self, *args, **kwargs): - super(OrderArticleToInventoryForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) if 'initial' in kwargs: self.name = kwargs['initial']['name'] self.category = kwargs['initial']['category'] diff --git a/kfet/models.py b/kfet/models.py index e5aed2b7..5cd4b757 100644 --- a/kfet/models.py +++ b/kfet/models.py @@ -255,7 +255,7 @@ class Account(models.Model): cof.save() if data: self.cofprofile = cof - super(Account, self).save(*args, **kwargs) + super().save(*args, **kwargs) def change_pwd(self, clear_password): from .auth.utils import hash_password @@ -423,7 +423,7 @@ class CheckoutStatement(models.Model): self.balance_new + self.amount_taken - self.balance_old) with transaction.atomic(): Checkout.objects.filter(pk=checkout_id).update(balance=self.balance_new) - super(CheckoutStatement, self).save(*args, **kwargs) + super().save(*args, **kwargs) else: self.amount_error = ( self.balance_new + self.amount_taken - self.balance_old) @@ -437,7 +437,7 @@ class CheckoutStatement(models.Model): and last_statement.balance_new != self.balance_new): Checkout.objects.filter(pk=self.checkout_id).update( balance=F('balance') - last_statement.balance_new + self.balance_new) - super(CheckoutStatement, self).save(*args, **kwargs) + super().save(*args, **kwargs) class ArticleCategory(models.Model): @@ -538,7 +538,7 @@ class InventoryArticle(models.Model): # d'erreur if not self.inventory.order: self.stock_error = self.stock_new - self.stock_old - super(InventoryArticle, self).save(*args, **kwargs) + super().save(*args, **kwargs) class Supplier(models.Model): diff --git a/kfet/views.py b/kfet/views.py index ef1885b3..df25c95e 100644 --- a/kfet/views.py +++ b/kfet/views.py @@ -493,7 +493,7 @@ class AccountNegativeList(ListView): context_object_name = 'negatives' def get_context_data(self, **kwargs): - context = super(AccountNegativeList, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) real_balances = (neg.account.real_balance for neg in self.object_list) context['negatives_sum'] = sum(real_balances) return context @@ -536,7 +536,7 @@ class CheckoutCreate(SuccessMessageMixin, CreateView): balance_new = checkout.balance, amount_taken = 0) - return super(CheckoutCreate, self).form_valid(form) + return super().form_valid(form) # Checkout - Read @@ -546,7 +546,7 @@ class CheckoutRead(DetailView): context_object_name = 'checkout' def get_context_data(self, **kwargs): - context = super(CheckoutRead, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['statements'] = context['checkout'].statements.order_by('-at') return context @@ -565,7 +565,7 @@ class CheckoutUpdate(SuccessMessageMixin, UpdateView): form.add_error(None, 'Permission refusée') return self.form_invalid(form) # Updating - return super(CheckoutUpdate, self).form_valid(form) + return super().form_valid(form) # ----- # Checkout Statement views @@ -617,7 +617,7 @@ class CheckoutStatementCreate(SuccessMessageMixin, CreateView): at = self.object.at) def get_context_data(self, **kwargs): - context = super(CheckoutStatementCreate, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) checkout = Checkout.objects.get(pk=self.kwargs['pk_checkout']) context['checkout'] = checkout return context @@ -633,7 +633,7 @@ class CheckoutStatementCreate(SuccessMessageMixin, CreateView): form.instance.balance_new = getAmountBalance(form.cleaned_data) form.instance.checkout_id = self.kwargs['pk_checkout'] form.instance.by = self.request.user.profile.account_kfet - return super(CheckoutStatementCreate, self).form_valid(form) + return super().form_valid(form) class CheckoutStatementUpdate(SuccessMessageMixin, UpdateView): model = CheckoutStatement @@ -645,7 +645,7 @@ class CheckoutStatementUpdate(SuccessMessageMixin, UpdateView): return reverse_lazy('kfet.checkout.read', kwargs={'pk':self.kwargs['pk_checkout']}) def get_context_data(self, **kwargs): - context = super(CheckoutStatementUpdate, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) checkout = Checkout.objects.get(pk=self.kwargs['pk_checkout']) context['checkout'] = checkout return context @@ -657,7 +657,7 @@ class CheckoutStatementUpdate(SuccessMessageMixin, UpdateView): return self.form_invalid(form) # Updating form.instance.amount_taken = getAmountTaken(form.instance) - return super(CheckoutStatementUpdate, self).form_valid(form) + return super().form_valid(form) # ----- # Category views @@ -689,7 +689,7 @@ class CategoryUpdate(SuccessMessageMixin, UpdateView): return self.form_invalid(form) # Updating - return super(CategoryUpdate, self).form_valid(form) + return super().form_valid(form) # ----- # Article views @@ -756,7 +756,7 @@ class ArticleCreate(SuccessMessageMixin, CreateView): ) # Creating - return super(ArticleCreate, self).form_valid(form) + return super().form_valid(form) # Article - Read @@ -766,7 +766,7 @@ class ArticleRead(DetailView): context_object_name = 'article' def get_context_data(self, **kwargs): - context = super(ArticleRead, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) inventoryarts = (InventoryArticle.objects .filter(article=self.object) .select_related('inventory') @@ -818,7 +818,7 @@ class ArticleUpdate(SuccessMessageMixin, UpdateView): article=article, supplier=supplier) # Updating - return super(ArticleUpdate, self).form_valid(form) + return super().form_valid(form) # ----- @@ -1709,7 +1709,7 @@ class InventoryRead(DetailView): context_object_name = 'inventory' def get_context_data(self, **kwargs): - context = super(InventoryRead, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) inventoryarticles = (InventoryArticle.objects .select_related('article', 'article__category') .filter(inventory = self.object) @@ -1727,7 +1727,7 @@ class OrderList(ListView): context_object_name = 'orders' def get_context_data(self, **kwargs): - context = super(OrderList, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context['suppliers'] = Supplier.objects.order_by('name') return context @@ -1856,7 +1856,7 @@ class OrderRead(DetailView): context_object_name = 'order' def get_context_data(self, **kwargs): - context = super(OrderRead, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) orderarticles = (OrderArticle.objects .select_related('article', 'article__category') .filter(order=self.object) @@ -2010,7 +2010,7 @@ class SupplierUpdate(SuccessMessageMixin, UpdateView): form.add_error(None, 'Permission refusée') return self.form_invalid(form) # Updating - return super(SupplierUpdate, self).form_valid(form) + return super().form_valid(form) # ========== @@ -2274,7 +2274,7 @@ class AccountStatBalance(PkUrlMixin, JSONDetailView): @method_decorator(login_required) def dispatch(self, *args, **kwargs): - return super(AccountStatBalance, self).dispatch(*args, **kwargs) + return super().dispatch(*args, **kwargs) # ------------------------