flake8
This commit is contained in:
parent
b53170feae
commit
32ba0e6111
18 changed files with 37 additions and 53 deletions
|
@ -1,13 +1,11 @@
|
|||
# coding: utf-8
|
||||
|
||||
from tastypie import fields, utils
|
||||
from tastypie import fields
|
||||
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, Normalien, Stage, StageMatiere
|
||||
from .models import Lieu, Normalien, Stage
|
||||
from .utils import approximate_distance
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from django_elasticsearch_dsl import Document, Index, fields
|
||||
from elasticsearch_dsl import analyzer, token_filter, tokenizer
|
||||
from elasticsearch_dsl import analyzer, token_filter
|
||||
|
||||
from .models import AvisLieu, AvisStage, Stage
|
||||
from .models import Stage
|
||||
from .statics import PAYS_OPTIONS
|
||||
|
||||
PAYS_DICT = dict(PAYS_OPTIONS)
|
||||
|
|
|
@ -7,7 +7,7 @@ from django import forms
|
|||
from django.contrib.auth.forms import PasswordResetForm
|
||||
from django.utils import timezone
|
||||
|
||||
from .models import AvisLieu, AvisStage, Lieu, Normalien, Stage, User
|
||||
from .models import AvisLieu, AvisStage, Lieu, Stage, User
|
||||
from .widgets import LatLonField
|
||||
|
||||
|
||||
|
@ -59,8 +59,10 @@ class StageForm(forms.ModelForm):
|
|||
"encadrants",
|
||||
]
|
||||
help_texts = {
|
||||
"thematiques": "Mettez une virgule pour valider votre thématique si la suggestion ne correspond pas ou si elle n'existe pas encore",
|
||||
"structure": "Nom de l'équipe, du laboratoire, de la startup... (si le lieu ne suffit pas)",
|
||||
"thematiques": "Mettez une virgule pour valider votre thématique si la suggestion ne "
|
||||
"correspond pas ou si elle n'existe pas encore",
|
||||
"structure": "Nom de l'équipe, du laboratoire, de la startup... (si le lieu ne suffit "
|
||||
"pas)",
|
||||
}
|
||||
labels = {
|
||||
"date_debut": "Date de début",
|
||||
|
@ -100,7 +102,7 @@ class AvisStageForm(HTMLTrimmerForm):
|
|||
"les_moins",
|
||||
]
|
||||
help_texts = {
|
||||
"chapo": u'"Trop long, pas lu" : une accroche résumant ce que vous avez pensé de ce séjour',
|
||||
"chapo": '"Trop long, pas lu" : une accroche résumant ce que vous avez pensé de ce séjour',
|
||||
"avis_ambiance": "Avez-vous passé un bon moment à ce travail ? Étiez-vous assez guidé⋅e ? Aviez-vous un bon contact avec vos encadrant⋅e⋅s ? Y avait-il une bonne ambiance dans l'équipe ?",
|
||||
"avis_sujet": "Quelle était votre mission ? Qu'en avez-vous retiré ? Le travail correspondait-il à vos attentes ? Était-ce à votre niveau, trop dur, trop facile ?",
|
||||
"avis_admin": "Avez-vous commencé votre travail à la date prévue ? Était-ce compliqué d'obtenir les documents nécessaires (visa, contrats, etc) ? L'administration de l'établissement vous a-t-elle aidé⋅e ? Étiez-vous rémunéré⋅e ?",
|
||||
|
@ -123,7 +125,7 @@ class AvisLieuForm(HTMLTrimmerForm):
|
|||
"les_moins",
|
||||
]
|
||||
help_texts = {
|
||||
"chapo": u'"Trop long, pas lu" : une accroche résumant ce que vous avez pensé de cet endroit',
|
||||
"chapo": '"Trop long, pas lu" : une accroche résumant ce que vous avez pensé de cet endroit',
|
||||
"avis_lieustage": "Qu'avez-vous pensé des lieux où vous travailliez ? Les bâtiments étaient-ils modernes ? Était-il agréable d'y travailler ?",
|
||||
"avis_pratique": "Avez-vous eu du mal à trouver un logement ? Y-a-t-il des choses que vous avez apprises sur place qu'il vous aurait été utile de savoir avant de partir ?",
|
||||
"avis_tourisme": "Y-a-t-il des lieux à visiter dans cette zone ? Avez-vous pratiqué des activités sportives ? Est-il facile de faire des rencontres ?",
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# coding: utf-8
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db.models import Count
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from avisstage.models import Lieu, Stage
|
||||
from avisstage.models import Lieu
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
# coding: utf-8
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.db.models import Count
|
||||
|
||||
from avisstage.models import Lieu, Stage
|
||||
from avisstage.models import Stage
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
@ -58,8 +57,7 @@ class Command(BaseCommand):
|
|||
print("Doublons détectés dans %s" % (stage,))
|
||||
for avis, alen in todel:
|
||||
print(
|
||||
" > Suppression de l'avis sur %s de %d mots"
|
||||
% (avis.lieu, alen)
|
||||
" > Suppression de l'avis sur %s de %d mots" % (avis.lieu, alen)
|
||||
)
|
||||
if rundb:
|
||||
avis.delete()
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
# coding: utf-8
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.db.models import Count
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from avisstage.models import Lieu, Stage
|
||||
from avisstage.models import Lieu
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from datetime import timedelta
|
||||
|
||||
from django.core.management.base import BaseCommand, CommandError
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.utils import timezone
|
||||
|
||||
from avisstage.models import Normalien
|
||||
|
@ -13,6 +13,6 @@ class Command(BaseCommand):
|
|||
return
|
||||
|
||||
def handle(self, *args, **options):
|
||||
old_conn = timezone.now() - timedelta(days=365)
|
||||
t = timezone.now() - timedelta(days=365)
|
||||
Normalien.objects.all().update(last_cas_connect=t)
|
||||
self.stdout.write(self.style.SUCCESS("Terminé"))
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
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
|
||||
|
@ -9,12 +8,9 @@ from django.contrib.auth.models import User
|
|||
from django.contrib.gis.db import models as geomodels
|
||||
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 .statics import (
|
||||
DEPARTEMENTS_DEFAUT,
|
||||
|
@ -26,7 +22,7 @@ from .statics import (
|
|||
TYPE_STAGE_DICT,
|
||||
TYPE_STAGE_OPTIONS,
|
||||
)
|
||||
from .utils import choices_length, is_email_ens
|
||||
from .utils import choices_length
|
||||
|
||||
|
||||
def _default_cas_login():
|
||||
|
@ -102,6 +98,7 @@ def create_basic_user_profile(sender, instance, created, **kwargs):
|
|||
|
||||
post_save.connect(create_basic_user_profile, sender=User)
|
||||
|
||||
|
||||
# Hook d'authENS : information du CAS
|
||||
def handle_cas_connection(sender, instance, created, cas_login, attributes, **kwargs):
|
||||
profil, created = Normalien.objects.get_or_create(user=instance)
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# coding: utf-8
|
||||
|
||||
DEPARTEMENTS_DEFAUT = (
|
||||
("phy", "Physique"),
|
||||
("maths", "Maths"),
|
||||
|
|
|
@ -9,7 +9,7 @@ from django.test import TestCase
|
|||
from django.urls import reverse
|
||||
from django.utils import timezone
|
||||
|
||||
from .models import AvisLieu, Lieu, Normalien, Stage, StageMatiere, User
|
||||
from .models import AvisLieu, Lieu, Stage, StageMatiere, User
|
||||
|
||||
|
||||
class ExperiENSTestCase(TestCase):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# coding: utf-8
|
||||
|
||||
import math
|
||||
import random
|
||||
from collections import Counter, defaultdict
|
||||
|
@ -12,7 +10,6 @@ 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.core.mail import send_mail
|
||||
from django.db.models import Count, Q
|
||||
|
@ -24,8 +21,6 @@ from django.views.generic import (
|
|||
DeleteView,
|
||||
DetailView,
|
||||
FormView,
|
||||
ListView,
|
||||
TemplateView,
|
||||
UpdateView,
|
||||
View,
|
||||
)
|
||||
|
@ -42,12 +37,12 @@ from .forms import (
|
|||
)
|
||||
from .models import AvisLieu, AvisStage, Lieu, Normalien, Stage
|
||||
from .utils import en_scolarite
|
||||
from .views_search import *
|
||||
|
||||
#
|
||||
# LECTURE
|
||||
#
|
||||
|
||||
|
||||
# Page d'accueil
|
||||
def index(request):
|
||||
num_stages = Stage.objects.filter(public=True).count()
|
||||
|
@ -516,7 +511,7 @@ class ConfirmeAdresse(LoginRequiredMixin, View):
|
|||
email = EmailAddress.objects.confirm(
|
||||
self.kwargs["key"], self.request.user, True
|
||||
)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
raise Http404()
|
||||
messages.add_message(
|
||||
self.request,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# coding: utf-8
|
||||
|
||||
import json
|
||||
import logging
|
||||
from datetime import date
|
||||
|
@ -8,10 +6,10 @@ 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.core.paginator import InvalidPage, 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
|
||||
from django.shortcuts import render
|
||||
|
||||
USE_ELASTICSEARCH = getattr(settings, "USE_ELASTICSEARCH", True)
|
||||
|
||||
|
@ -24,6 +22,7 @@ from .statics import NIVEAU_SCOL_OPTIONS, TYPE_LIEU_OPTIONS, TYPE_STAGE_OPTIONS
|
|||
|
||||
logger = logging.getLogger("recherche")
|
||||
|
||||
|
||||
# Recherche
|
||||
class SearchForm(forms.Form):
|
||||
generique = forms.CharField(required=False)
|
||||
|
|
|
@ -12,7 +12,7 @@ https://docs.djangoproject.com/en/1.7/ref/settings/
|
|||
import os
|
||||
from django.urls import reverse_lazy
|
||||
|
||||
from .secrets import SECRET_KEY, GOOGLE_API_KEY, MAPBOX_API_KEY
|
||||
from .secrets import SECRET_KEY, GOOGLE_API_KEY, MAPBOX_API_KEY # noqa
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
from .settings_base import *
|
||||
import os
|
||||
|
||||
from .settings_base import BASE_DIR, INSTALLED_APPS, MIDDLEWARE
|
||||
|
||||
DEBUG = True
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from .settings_base import *
|
||||
import os
|
||||
|
||||
import os, sys
|
||||
from .settings_base import * # noqa
|
||||
|
||||
PROJECT_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
BASE_DIR = os.path.dirname(PROJECT_DIR)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from django.conf import settings
|
||||
from django.urls import include, path
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
|
||||
urlpatterns = [
|
||||
path("", include("avisstage.urls")),
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
import sys
|
||||
from collections import defaultdict
|
||||
|
||||
from allauth.account.models import EmailAddress
|
||||
from allauth.socialaccount.models import SocialAccount
|
||||
|
||||
from avisstage.models import Normalien
|
||||
|
||||
from collections import defaultdict
|
||||
|
||||
accounts = SocialAccount.objects.all().prefetch_related("user")
|
||||
profils = Normalien.objects.all()
|
||||
addresses = EmailAddress.objects.all()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[flake8]
|
||||
max-line-length = 99
|
||||
exclude = .git, *.pyc, __pycache__, migrations
|
||||
extend-ignore = E231, E203
|
||||
extend-ignore = E231, E203, E402
|
||||
|
||||
[isort]
|
||||
profile = black
|
||||
|
|
Loading…
Reference in a new issue