Merge branch 'aureplop/linters-for-petitscours' into 'master'

style -- Linters for petitscours, fix isort

See merge request klub-dev-ens/gestioCOF!335
This commit is contained in:
Martin Pepin 2019-01-05 19:16:28 +01:00
commit a057776e1f
9 changed files with 21 additions and 18 deletions

View file

@ -52,9 +52,9 @@ linters:
- pip install --upgrade black isort flake8 - pip install --upgrade black isort flake8
script: script:
- black --check . - black --check .
- isort --recursive --check-only --diff bda cof gestioncof kfet provisioning shared utils - isort --recursive --check-only --diff bda cof gestioncof kfet petitscours provisioning shared utils
# Print errors only # Print errors only
- flake8 --exit-zero bda cof gestioncof kfet provisioning shared utils - flake8 --exit-zero bda cof gestioncof kfet petitscours provisioning shared utils
cache: cache:
key: linters key: linters
paths: paths:

View file

@ -7,13 +7,6 @@ from django.core.urlresolvers import reverse
from django.db.models import Q from django.db.models import Q
from django.utils.safestring import mark_safe from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from petitscours.models import (
PetitCoursAbility,
PetitCoursAttribution,
PetitCoursAttributionCounter,
PetitCoursDemande,
PetitCoursSubject,
)
from gestioncof.models import ( from gestioncof.models import (
Club, Club,
@ -27,6 +20,13 @@ from gestioncof.models import (
SurveyQuestion, SurveyQuestion,
SurveyQuestionAnswer, SurveyQuestionAnswer,
) )
from petitscours.models import (
PetitCoursAbility,
PetitCoursAttribution,
PetitCoursAttributionCounter,
PetitCoursDemande,
PetitCoursSubject,
)
def add_link_field(target_model="", field="", link_text=str, desc_text=str): def add_link_field(target_model="", field="", link_text=str, desc_text=str):

View file

@ -12,6 +12,8 @@ import random
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.management import call_command from django.core.management import call_command
from gestioncof.management.base import MyBaseCommand
from petitscours.models import ( from petitscours.models import (
LEVELS_CHOICES, LEVELS_CHOICES,
PetitCoursAbility, PetitCoursAbility,
@ -19,8 +21,6 @@ from petitscours.models import (
PetitCoursSubject, PetitCoursSubject,
) )
from gestioncof.management.base import MyBaseCommand
# Où sont stockés les fichiers json # Où sont stockés les fichiers json
DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data") DATA_DIR = os.path.join(os.path.dirname(os.path.dirname(__file__)), "data")

View file

@ -3,9 +3,9 @@ from django.db import models
from django.db.models.signals import post_delete, post_save from django.db.models.signals import post_delete, post_save
from django.dispatch import receiver from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from petitscours.models import choices_length
from bda.models import Spectacle from bda.models import Spectacle
from petitscours.models import choices_length
TYPE_COMMENT_FIELD = (("text", _("Texte long")), ("char", _("Texte court"))) TYPE_COMMENT_FIELD = (("text", _("Texte long")), ("char", _("Texte court")))

View file

@ -3,6 +3,7 @@ from django import forms
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.forms import ModelForm from django.forms import ModelForm
from django.forms.models import BaseInlineFormSet, inlineformset_factory from django.forms.models import BaseInlineFormSet, inlineformset_factory
from petitscours.models import PetitCoursAbility, PetitCoursDemande from petitscours.models import PetitCoursAbility, PetitCoursDemande

View file

@ -2,6 +2,7 @@ import os
from django.conf import settings from django.conf import settings
from django.core.management import call_command from django.core.management import call_command
from petitscours.models import ( from petitscours.models import (
PetitCoursAbility, PetitCoursAbility,
PetitCoursAttributionCounter, PetitCoursAttributionCounter,

View file

@ -1,8 +1,8 @@
from django.conf.urls import url from django.conf.urls import url
from petitscours import views
from petitscours.views import DemandeDetailView, DemandeListView
from gestioncof.decorators import buro_required from gestioncof.decorators import buro_required
from petitscours import views
from petitscours.views import DemandeDetailView, DemandeListView
urlpatterns = [ urlpatterns = [
url(r"^inscription$", views.inscription, name="petits-cours-inscription"), url(r"^inscription$", views.inscription, name="petits-cours-inscription"),

View file

@ -11,6 +11,9 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone from django.utils import timezone
from django.views.decorators.csrf import csrf_exempt from django.views.decorators.csrf import csrf_exempt
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from gestioncof.decorators import buro_required
from gestioncof.models import CofProfile
from petitscours.forms import DemandeForm, MatieresFormSet from petitscours.forms import DemandeForm, MatieresFormSet
from petitscours.models import ( from petitscours.models import (
PetitCoursAbility, PetitCoursAbility,
@ -19,9 +22,6 @@ from petitscours.models import (
PetitCoursDemande, PetitCoursDemande,
) )
from gestioncof.decorators import buro_required
from gestioncof.models import CofProfile
class DemandeListView(ListView): class DemandeListView(ListView):
queryset = PetitCoursDemande.objects.prefetch_related("matieres").order_by( queryset = PetitCoursDemande.objects.prefetch_related("matieres").order_by(

View file

@ -4,6 +4,7 @@ source =
cof cof
gestioncof gestioncof
kfet kfet
petitscours
shared shared
utils utils
omit = omit =
@ -33,7 +34,7 @@ default_section = THIRDPARTY
force_grid_wrap = 0 force_grid_wrap = 0
include_trailing_comma = true include_trailing_comma = true
known_django = django known_django = django
known_first_party = bda,cof,gestioncof,kfet,shared,utils known_first_party = bda,cof,gestioncof,kfet,petitscours,shared,utils
line_length = 88 line_length = 88
multi_line_output = 3 multi_line_output = 3
not_skip = __init__.py not_skip = __init__.py