Reformatage #29
21 changed files with 121 additions and 106 deletions
|
@ -1,9 +1,10 @@
|
||||||
|
import authens.models as authmod
|
||||||
|
|
||||||
from django.contrib import admin
|
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 avisstage.models import *
|
|
||||||
|
|
||||||
import authens.models as authmod
|
from avisstage.models import *
|
||||||
|
|
||||||
|
|
||||||
class NormalienInline(admin.StackedInline):
|
class NormalienInline(admin.StackedInline):
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
|
||||||
from tastypie.resources import ModelResource
|
|
||||||
from tastypie.authentication import SessionAuthentication
|
|
||||||
from tastypie import fields, utils
|
from tastypie import fields, utils
|
||||||
|
from tastypie.authentication import SessionAuthentication
|
||||||
|
from tastypie.resources import ModelResource
|
||||||
|
|
||||||
from django.contrib.gis import geos
|
from django.contrib.gis import geos
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from .models import Lieu, Stage, Normalien, StageMatiere
|
from .models import Lieu, Normalien, Stage, StageMatiere
|
||||||
from .utils import approximate_distance
|
from .utils import approximate_distance
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
|
from django.urls import reverse
|
||||||
|
|
||||||
|
|
||||||
def en_scolarite_required(view_func):
|
def en_scolarite_required(view_func):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from django_elasticsearch_dsl import DocType, Index, fields
|
from django_elasticsearch_dsl import DocType, Index, fields
|
||||||
from elasticsearch_dsl import analyzer, token_filter, tokenizer
|
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
|
from .statics import PAYS_OPTIONS
|
||||||
|
|
||||||
PAYS_DICT = dict(PAYS_OPTIONS)
|
PAYS_DICT = dict(PAYS_OPTIONS)
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
|
import re
|
||||||
import unicodedata
|
import unicodedata
|
||||||
|
|
||||||
|
from simple_email_confirmation.models import EmailAddress
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.auth.forms import PasswordResetForm
|
from django.contrib.auth.forms import PasswordResetForm
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
from simple_email_confirmation.models import EmailAddress
|
from .models import AvisLieu, AvisStage, Lieu, Normalien, Stage, User
|
||||||
|
|
||||||
import re
|
|
||||||
|
|
||||||
from .models import Normalien, Stage, Lieu, AvisLieu, AvisStage, User
|
|
||||||
from .widgets import LatLonField
|
from .widgets import LatLonField
|
||||||
|
|
||||||
|
|
||||||
# Sur-classe utile
|
# Sur-classe utile
|
||||||
class HTMLTrimmerForm(forms.ModelForm):
|
class HTMLTrimmerForm(forms.ModelForm):
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from avisstage.models import Stage, Lieu
|
|
||||||
|
from avisstage.models import Lieu, Stage
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from avisstage.models import Stage, Lieu
|
|
||||||
|
from avisstage.models import Lieu, Stage
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db.models import Count
|
from django.db.models import Count
|
||||||
from avisstage.models import Stage, Lieu
|
|
||||||
|
from avisstage.models import Lieu, Stage
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -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 datetime import timedelta
|
||||||
|
|
||||||
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
from avisstage.models import Normalien
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
help = 'Réinitialise les statuts "en scolarité" de tout le monde'
|
help = 'Réinitialise les statuts "en scolarité" de tout le monde'
|
||||||
|
|
|
@ -2,14 +2,15 @@
|
||||||
# Generated by Django 1.11 on 2017-06-20 17:45
|
# Generated by Django 1.11 on 2017-06-20 17:45
|
||||||
from __future__ import unicode_literals
|
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 taggit_autosuggest.managers
|
||||||
import tinymce.models
|
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):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@
|
||||||
# Generated by Django 1.11.2 on 2017-10-02 20:43
|
# Generated by Django 1.11.2 on 2017-10-02 20:43
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import tinymce.models
|
import tinymce.models
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# Generated by Django 2.2.17 on 2021-01-17 11:08
|
# Generated by Django 2.2.17 on 2021-01-17 11:08
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from django.apps import apps as global_apps
|
from django.apps import apps as global_apps
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# Generated by Django 2.2.17 on 2021-01-31 18:54
|
# Generated by Django 2.2.17 on 2021-01-31 18:54
|
||||||
|
|
||||||
import avisstage.models
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
import avisstage.models
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
|
|
@ -1,34 +1,32 @@
|
||||||
from django.db import models
|
from datetime import timedelta
|
||||||
from django.db.models.signals import post_save
|
|
||||||
|
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.auth.models import User
|
||||||
from django.contrib.gis.db import models as geomodels
|
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.forms.widgets import DateInput
|
||||||
|
from django.template.defaultfilters import slugify
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.utils.functional import cached_property
|
from django.utils.functional import cached_property
|
||||||
from django.utils.html import strip_tags
|
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 (
|
from .statics import (
|
||||||
DEPARTEMENTS_DEFAUT,
|
DEPARTEMENTS_DEFAUT,
|
||||||
PAYS_OPTIONS,
|
|
||||||
TYPE_LIEU_OPTIONS,
|
|
||||||
TYPE_STAGE_OPTIONS,
|
|
||||||
TYPE_LIEU_DICT,
|
|
||||||
TYPE_STAGE_DICT,
|
|
||||||
NIVEAU_SCOL_OPTIONS,
|
|
||||||
NIVEAU_SCOL_DICT,
|
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():
|
def _default_cas_login():
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
# coding: utf-8
|
# coding: utf-8
|
||||||
|
import re
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
|
||||||
from avisstage.forms import LieuForm, FeedbackForm
|
from avisstage.forms import FeedbackForm, LieuForm
|
||||||
import re
|
|
||||||
|
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
from authens.tests.cas_utils import FakeCASClient
|
|
||||||
from authens.models import CASAccount, OldCASAccount
|
|
||||||
|
|
||||||
from datetime import date, timedelta
|
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 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):
|
class ExperiENSTestCase(TestCase):
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
from django.urls import include, path
|
|
||||||
from . import views, api
|
|
||||||
from tastypie.api import Api
|
from tastypie.api import Api
|
||||||
|
|
||||||
|
from django.urls import include, path
|
||||||
|
|
||||||
|
from . import api, views
|
||||||
|
|
||||||
v1_api = Api(api_name="v1")
|
v1_api = Api(api_name="v1")
|
||||||
v1_api.register(api.LieuResource())
|
v1_api.register(api.LieuResource())
|
||||||
v1_api.register(api.StageResource())
|
v1_api.register(api.StageResource())
|
||||||
|
|
|
@ -1,49 +1,49 @@
|
||||||
# coding: utf-8
|
# 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 import forms
|
||||||
from django.urls import reverse, reverse_lazy
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from django.contrib import messages
|
||||||
from django.contrib.admin.views.decorators import staff_member_required
|
from django.contrib.admin.views.decorators import staff_member_required
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.contrib.auth.tokens import default_token_generator
|
from django.contrib.auth.tokens import default_token_generator
|
||||||
from django.contrib.auth.views import PasswordResetConfirmView
|
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.core.mail import send_mail
|
||||||
from django.db.models import Q, Count
|
from django.db.models import Count, Q
|
||||||
from collections import Counter, defaultdict
|
from django.http import Http404, HttpResponseForbidden, JsonResponse
|
||||||
from simple_email_confirmation.models import EmailAddress
|
from django.shortcuts import get_object_or_404, redirect, render
|
||||||
|
from django.urls import reverse, reverse_lazy
|
||||||
from .models import Normalien, Stage, Lieu, AvisLieu, AvisStage
|
from django.views.generic import (
|
||||||
from .forms import (
|
CreateView,
|
||||||
StageForm,
|
DeleteView,
|
||||||
LieuForm,
|
DetailView,
|
||||||
AvisStageForm,
|
FormView,
|
||||||
AvisLieuForm,
|
ListView,
|
||||||
FeedbackForm,
|
TemplateView,
|
||||||
AdresseEmailForm,
|
UpdateView,
|
||||||
ReinitMdpForm,
|
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 .utils import en_scolarite
|
||||||
|
|
||||||
from .views_search import *
|
from .views_search import *
|
||||||
|
|
||||||
import random, math
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# LECTURE
|
# LECTURE
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,18 +1,17 @@
|
||||||
# coding: utf-8
|
# 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 json
|
||||||
import logging
|
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)
|
USE_ELASTICSEARCH = getattr(settings, "USE_ELASTICSEARCH", True)
|
||||||
|
|
||||||
|
@ -21,8 +20,7 @@ if USE_ELASTICSEARCH:
|
||||||
|
|
||||||
from .decorators import en_scolarite_required
|
from .decorators import en_scolarite_required
|
||||||
from .models import Stage
|
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")
|
logger = logging.getLogger("recherche")
|
||||||
|
|
||||||
|
|
10
setup.cfg
Normal file
10
setup.cfg
Normal 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
|
Loading…
Reference in a new issue