Reformatage #29

Closed
thubrecht wants to merge 19 commits from thubrecht/python3 into master
21 changed files with 121 additions and 106 deletions
Showing only changes of commit 5d3f840de1 - Show all commits

View file

@ -1,9 +1,10 @@
import authens.models as authmod
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User
from avisstage.models import *
import authens.models as authmod
from avisstage.models import *
class NormalienInline(admin.StackedInline):

View file

@ -1,13 +1,13 @@
# coding: utf-8
from tastypie.resources import ModelResource
from tastypie.authentication import SessionAuthentication
from tastypie import fields, utils
from tastypie.authentication import SessionAuthentication
from tastypie.resources import ModelResource
from django.contrib.gis import geos
from django.urls import reverse
from .models import Lieu, Stage, Normalien, StageMatiere
from .models import Lieu, Normalien, Stage, StageMatiere
from .utils import approximate_distance

View file

@ -1,7 +1,7 @@
from functools import wraps
from django.urls import reverse
from django.shortcuts import redirect
from django.urls import reverse
def en_scolarite_required(view_func):

View file

@ -1,7 +1,7 @@
from django_elasticsearch_dsl import DocType, Index, fields
from elasticsearch_dsl import analyzer, token_filter, tokenizer
from .models import Stage, AvisStage, AvisLieu
from .models import AvisLieu, AvisStage, Stage
from .statics import PAYS_OPTIONS
PAYS_DICT = dict(PAYS_OPTIONS)

View file

@ -1,16 +1,16 @@
import re
import unicodedata
from simple_email_confirmation.models import EmailAddress
from django import forms
from django.contrib.auth.forms import PasswordResetForm
from django.utils import timezone
from simple_email_confirmation.models import EmailAddress
import re
from .models import Normalien, Stage, Lieu, AvisLieu, AvisStage, User
from .models import AvisLieu, AvisStage, Lieu, Normalien, Stage, User
from .widgets import LatLonField
# Sur-classe utile
class HTMLTrimmerForm(forms.ModelForm):
def clean(self):

View file

@ -1,7 +1,8 @@
# coding: utf-8
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
from avisstage.models import Stage, Lieu
from avisstage.models import Lieu, Stage
class Command(BaseCommand):

View file

@ -1,7 +1,8 @@
# coding: utf-8
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
from avisstage.models import Stage, Lieu
from avisstage.models import Lieu, Stage
class Command(BaseCommand):

View file

@ -1,7 +1,8 @@
# coding: utf-8
from django.core.management.base import BaseCommand, CommandError
from django.db.models import Count
from avisstage.models import Stage, Lieu
from avisstage.models import Lieu, Stage
class Command(BaseCommand):

View file

@ -1,9 +1,10 @@
from django.core.management.base import BaseCommand, CommandError
from avisstage.models import Normalien
from django.utils import timezone
from datetime import timedelta
from django.core.management.base import BaseCommand, CommandError
from django.utils import timezone
from avisstage.models import Normalien
class Command(BaseCommand):
help = 'Réinitialise les statuts "en scolarité" de tout le monde'

View file

@ -2,14 +2,15 @@
# Generated by Django 1.11 on 2017-06-20 17:45
from __future__ import unicode_literals
from django.conf import settings
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone
import taggit_autosuggest.managers
import tinymce.models
import django.contrib.gis.db.models.fields
import django.db.models.deletion
import django.utils.timezone
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -2,9 +2,10 @@
# Generated by Django 1.11.2 on 2017-10-02 20:43
from __future__ import unicode_literals
from django.db import migrations, models
import tinymce.models
from django.db import migrations, models
class Migration(migrations.Migration):

View file

@ -1,8 +1,8 @@
# Generated by Django 2.2.17 on 2021-01-17 11:08
import django.db.models.deletion
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):

View file

@ -1,6 +1,5 @@
from django.apps import apps as global_apps
from django.db import migrations
from django.utils import timezone

View file

@ -1,8 +1,9 @@
# Generated by Django 2.2.17 on 2021-01-31 18:54
import avisstage.models
from django.db import migrations, models
import avisstage.models
class Migration(migrations.Migration):

View file

@ -1,34 +1,32 @@
from django.db import models
from django.db.models.signals import post_save
from datetime import timedelta
from authens.models import CASAccount
from authens.signals import post_cas_connect
from taggit_autosuggest.managers import TaggableManager
from tinymce.models import HTMLField as RichTextField
from django.contrib.auth.models import User
from django.contrib.gis.db import models as geomodels
from django.template.defaultfilters import slugify
from django.db import models
from django.db.models.signals import post_save
from django.forms.widgets import DateInput
from django.template.defaultfilters import slugify
from django.urls import reverse
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.html import strip_tags
from taggit_autosuggest.managers import TaggableManager
from tinymce.models import HTMLField as RichTextField
from authens.signals import post_cas_connect
from authens.models import CASAccount
from datetime import timedelta
from .utils import choices_length, is_email_ens
from .statics import (
DEPARTEMENTS_DEFAUT,
PAYS_OPTIONS,
TYPE_LIEU_OPTIONS,
TYPE_STAGE_OPTIONS,
TYPE_LIEU_DICT,
TYPE_STAGE_DICT,
NIVEAU_SCOL_OPTIONS,
NIVEAU_SCOL_DICT,
NIVEAU_SCOL_OPTIONS,
PAYS_OPTIONS,
TYPE_LIEU_DICT,
TYPE_LIEU_OPTIONS,
TYPE_STAGE_DICT,
TYPE_STAGE_OPTIONS,
)
from .utils import choices_length, is_email_ens
def _default_cas_login():

View file

@ -1,8 +1,9 @@
# coding: utf-8
import re
from django import template
from avisstage.forms import LieuForm, FeedbackForm
import re
from avisstage.forms import FeedbackForm, LieuForm
register = template.Library()

View file

@ -1,16 +1,15 @@
from authens.tests.cas_utils import FakeCASClient
from authens.models import CASAccount, OldCASAccount
from datetime import date, timedelta
from django.test import TestCase
from django.urls import reverse
from django.conf import settings
from django.utils import timezone
from unittest import mock
from .models import User, Normalien, Lieu, Stage, StageMatiere, AvisLieu
from authens.models import CASAccount, OldCASAccount
from authens.tests.cas_utils import FakeCASClient
from django.conf import settings
from django.test import TestCase
from django.urls import reverse
from django.utils import timezone
from .models import AvisLieu, Lieu, Normalien, Stage, StageMatiere, User
class ExperiENSTestCase(TestCase):

View file

@ -1,7 +1,9 @@
from django.urls import include, path
from . import views, api
from tastypie.api import Api
from django.urls import include, path
from . import api, views
v1_api = Api(api_name="v1")
v1_api.register(api.LieuResource())
v1_api.register(api.StageResource())

View file

@ -1,49 +1,49 @@
# coding: utf-8
from django.shortcuts import render, redirect, get_object_or_404
import math
import random
from collections import Counter, defaultdict
from braces.views import LoginRequiredMixin
from simple_email_confirmation.models import EmailAddress
from django.views.generic import (
DetailView,
ListView,
UpdateView,
CreateView,
TemplateView,
DeleteView,
FormView,
View,
)
from django.views.generic.detail import SingleObjectMixin
from django import forms
from django.urls import reverse, reverse_lazy
from django.conf import settings
from django.contrib import messages
from django.contrib.admin.views.decorators import staff_member_required
from django.contrib.auth.decorators import login_required
from django.contrib.auth.tokens import default_token_generator
from django.contrib.auth.views import PasswordResetConfirmView
from django.contrib import messages
from braces.views import LoginRequiredMixin
from django.http import JsonResponse, HttpResponseForbidden, Http404
from django.core.mail import send_mail
from django.db.models import Q, Count
from collections import Counter, defaultdict
from simple_email_confirmation.models import EmailAddress
from .models import Normalien, Stage, Lieu, AvisLieu, AvisStage
from .forms import (
StageForm,
LieuForm,
AvisStageForm,
AvisLieuForm,
FeedbackForm,
AdresseEmailForm,
ReinitMdpForm,
from django.db.models import Count, Q
from django.http import Http404, HttpResponseForbidden, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy
from django.views.generic import (
CreateView,
DeleteView,
DetailView,
FormView,
ListView,
TemplateView,
UpdateView,
View,
)
from django.views.generic.detail import SingleObjectMixin
from .forms import (
AdresseEmailForm,
AvisLieuForm,
AvisStageForm,
FeedbackForm,
LieuForm,
ReinitMdpForm,
StageForm,
)
from .models import AvisLieu, AvisStage, Lieu, Normalien, Stage
from .utils import en_scolarite
from .views_search import *
import random, math
#
# LECTURE
#

View file

@ -1,18 +1,17 @@
# coding: utf-8
from datetime import date
from django import forms
from django.contrib.auth.decorators import login_required
from django.conf import settings
from django.core.cache import cache
from django.core.paginator import Paginator
from django.db.models import Q, Case, When
from django.http import JsonResponse, HttpResponseBadRequest
from django.shortcuts import render, redirect, get_object_or_404
import json
import logging
from datetime import date
from django import forms
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.core.cache import cache
from django.core.paginator import Paginator
from django.db.models import Case, Q, When
from django.http import HttpResponseBadRequest, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
USE_ELASTICSEARCH = getattr(settings, "USE_ELASTICSEARCH", True)
@ -21,8 +20,7 @@ if USE_ELASTICSEARCH:
from .decorators import en_scolarite_required
from .models import Stage
from .statics import TYPE_LIEU_OPTIONS, TYPE_STAGE_OPTIONS, NIVEAU_SCOL_OPTIONS
from .statics import NIVEAU_SCOL_OPTIONS, TYPE_LIEU_OPTIONS, TYPE_STAGE_OPTIONS
logger = logging.getLogger("recherche")

10
setup.cfg Normal file
View file

@ -0,0 +1,10 @@
[flake8]
max-line-length = 99
exclude = .git, *.pyc, __pycache__, migrations
extend-ignore = E231, E203
[isort]
profile = black
known_django = django
known_first_party = avisstage
sections = FUTURE,STDLIB,THIRDPARTY,DJANGO,FIRSTPARTY,LOCALFOLDER