pylint khana --errors-only says it's OK
This commit is contained in:
parent
8e9b4b8aa7
commit
91ee5cdc65
|
@ -15,7 +15,6 @@ class PointAdmin(admin.ModelAdmin):
|
|||
"total",
|
||||
)
|
||||
ordering = ("gymnast",)
|
||||
# search_fields = ('longLabel', 'shortLabel')
|
||||
list_filter = ("gymnast", "event", "routine_type")
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.db import models
|
||||
|
||||
|
@ -14,7 +13,6 @@ class Point(models.Model):
|
|||
"people.Gymnast", on_delete=models.CASCADE, default=None
|
||||
)
|
||||
event = models.ForeignKey("planning.Event", on_delete=models.CASCADE, default=None)
|
||||
# routine=models.ForeignKey('objective.Routine')
|
||||
routine_type = models.PositiveSmallIntegerField(choices=ROUTINETYPE_CHOICE)
|
||||
point_execution = models.DecimalField(max_digits=5, decimal_places=3)
|
||||
point_difficulty = models.DecimalField(max_digits=3, decimal_places=1)
|
||||
|
@ -24,9 +22,8 @@ class Point(models.Model):
|
|||
total = models.DecimalField(max_digits=6, decimal_places=3)
|
||||
|
||||
def __str__(self):
|
||||
return "%s, %s - %s" % (
|
||||
self.gymnast.lastname,
|
||||
self.gymnast.firstname,
|
||||
return "%s - %s" % (
|
||||
self.gymnast,
|
||||
self.total,
|
||||
)
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
@ -6,9 +5,10 @@ from django.http import HttpResponse, HttpResponseRedirect
|
|||
from django.views.decorators.http import require_http_methods
|
||||
from django.db.models import Q
|
||||
|
||||
from khana.people.models import Gymnast
|
||||
|
||||
from .forms import ScoreForm
|
||||
from .models import Point
|
||||
from people.models import Gymnast
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
|
@ -1,34 +1,35 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.db.models import Q, Count
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils.html import format_html
|
||||
from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.http import require_http_methods
|
||||
|
||||
from datetime import datetime, timedelta, date
|
||||
from functools import reduce
|
||||
import operator
|
||||
import simplejson
|
||||
|
||||
from planning.models import (
|
||||
from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Q, Count
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.utils.html import format_html
|
||||
from django.views.decorators.http import require_http_methods
|
||||
|
||||
from khana.planning.models import (
|
||||
Event,
|
||||
Unavailability,
|
||||
Course,
|
||||
Subgroup,
|
||||
Training,
|
||||
) # planning model
|
||||
from people.models import Gymnast, Accident # people model
|
||||
)
|
||||
from khana.objective.models import Skill, Routine
|
||||
from khana.people.models import Gymnast, Accident
|
||||
|
||||
from .models import (
|
||||
Club,
|
||||
Place,
|
||||
Country,
|
||||
)
|
||||
from .forms import PlaceForm
|
||||
from objective.models import Skill, Routine # objective model
|
||||
|
||||
|
||||
def __diffTime(end, start):
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
import math
|
||||
|
||||
from people.models import Gymnast
|
||||
from objectives.models import Skill
|
||||
from khana.people.models import Gymnast
|
||||
from khana.objective.models import Skill
|
||||
|
||||
|
||||
def suggest_routine(
|
||||
|
@ -58,16 +59,17 @@ def suggest_routine(
|
|||
for skill in skill_list:
|
||||
current_routine.append(skill)
|
||||
current_routine.append(
|
||||
self.suggest_routine(
|
||||
request,
|
||||
total_difficulty_score - skill.difficulty,
|
||||
max_difficulty_score,
|
||||
routine_length - 1,
|
||||
competition,
|
||||
logic,
|
||||
gymnast,
|
||||
skill,
|
||||
)
|
||||
None
|
||||
# suggest_routine()
|
||||
# request,
|
||||
# total_difficulty_score - skill.difficulty,
|
||||
# max_difficulty_score,
|
||||
# routine_length - 1,
|
||||
# competition,
|
||||
# logic,
|
||||
# gymnast,
|
||||
# skill,
|
||||
# )
|
||||
)
|
||||
current_routine.pop()
|
||||
# def knapSack(W, wt, val, n):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
from django.contrib import admin
|
||||
|
||||
# Register your models here.
|
||||
from .models import (
|
||||
Educative,
|
||||
TouchPosition,
|
||||
|
@ -30,10 +30,6 @@ def duplicate_skill(self, SkillAdmin, request, queryset):
|
|||
class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
||||
model = Skill
|
||||
|
||||
# related_search_fields = {
|
||||
# 'departure': ('label', 'short_label'),
|
||||
# 'landing': ('label', 'short_label')
|
||||
# }
|
||||
fields = (
|
||||
"label",
|
||||
"short_label",
|
||||
|
@ -66,7 +62,7 @@ class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
|||
"age_boy",
|
||||
"age_girl",
|
||||
)
|
||||
# list_display = ('label', 'short_label', 'prerequisite')
|
||||
|
||||
ordering = ("label", "short_label")
|
||||
search_fields = ("rank", "label", "short_label")
|
||||
list_filter = (
|
||||
|
@ -127,10 +123,10 @@ class RoutineAdmin(admin.ModelAdmin):
|
|||
js = ("js/routine.js",)
|
||||
|
||||
# TODO: ne proposer QUE les SKILL comme educatif
|
||||
def get_related_filter(self, model, request):
|
||||
# print('boum')
|
||||
if not issubclass(model, Educative):
|
||||
return super(Skill, self).get_related_filter(model, request)
|
||||
# def get_related_filter(self, model, request):
|
||||
# # print('boum')
|
||||
# if not issubclass(model, Educative):
|
||||
# return super(Skill, self).get_related_filter(model, request)
|
||||
|
||||
|
||||
class RoutineSkillAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from datetime import date
|
||||
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
from django.db.models import Q
|
||||
|
||||
from khana.base.models import Markdownizable
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class Educative(Markdownizable):
|
||||
|
@ -40,7 +43,7 @@ class Educative(Markdownizable):
|
|||
def __str__(self):
|
||||
return "%s - %s (level: %s | diff: %s)" % (
|
||||
self.rank,
|
||||
self.longLabel,
|
||||
self.label,
|
||||
self.level,
|
||||
self.difficulty,
|
||||
)
|
||||
|
@ -62,7 +65,7 @@ class TouchPosition(models.Model):
|
|||
is_default = models.BooleanField(verbose_name="Défaut")
|
||||
|
||||
def __str__(self):
|
||||
return "%s" % (self.longLabel)
|
||||
return "%s" % (self.label)
|
||||
|
||||
|
||||
def get_default_position():
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.urls import reverse
|
||||
from django.test import TestCase, Client
|
||||
from django.urls import reverse
|
||||
|
||||
from .models import Routine_Skill, Routine, Skill, TouchPosition
|
||||
from .models import RoutineSkill, Routine, Skill, TouchPosition
|
||||
from .views import link_skill_to_routine
|
||||
|
||||
|
||||
|
@ -51,4 +50,4 @@ class RoutineTest(TestCase):
|
|||
|
||||
# print(response)
|
||||
self.assertEquals(response.status_code, 200)
|
||||
self.assertTrue(Routine_Skill.objects.exists())
|
||||
self.assertTrue(RoutineSkill.objects.exists())
|
||||
|
|
|
@ -1,26 +1,24 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.db.models import Q
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.urls import reverse
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
from datetime import datetime
|
||||
import math
|
||||
import random
|
||||
|
||||
import simplejson
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.urls import reverse
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.views.decorators.clickjacking import xframe_options_exempt
|
||||
|
||||
from khana.people.models import Gymnast, CanDoRelation
|
||||
|
||||
from .models import Skill, Educative, Routine, Chrono, RoutineSkill
|
||||
from .forms import RoutineForm, ChronoForm
|
||||
from people.models import Gymnast, CanDoRelation
|
||||
|
||||
from datetime import datetime
|
||||
import random
|
||||
|
||||
import math
|
||||
|
||||
|
||||
def __lookup(lookup_class, lookup_value):
|
||||
|
@ -30,7 +28,7 @@ def __lookup(lookup_class, lookup_value):
|
|||
|
||||
:param lookup_class: classe fille dans laquelle la recherche doit être
|
||||
faite.
|
||||
:type lookup_class: string (`skill` ou `routine`).
|
||||
:type lookup_class: string (`skill` ou `routine`).ùpdem
|
||||
:param lookup_value: pattern de recherche.
|
||||
:type lookup_value: string.
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
||||
|
||||
from django import forms
|
||||
from django.contrib.auth import get_user_model
|
||||
|
||||
from .models import (
|
||||
Accident,
|
||||
|
@ -8,7 +9,7 @@ from .models import (
|
|||
GymnastHasRoutine,
|
||||
)
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class AccidentForm(forms.ModelForm):
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
from django.core.management.base import NoArgsCommand
|
||||
|
||||
|
||||
class Command(NoArgsCommand):
|
||||
help = 'Ecrit "et Bim !!!11"'
|
||||
|
||||
def handle_noargs(self, **options):
|
||||
print(" ET BIM !!!11")
|
|
@ -44,13 +44,15 @@ Notes:
|
|||
|
||||
from datetime import date
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
|
||||
import pendulum
|
||||
|
||||
from khana.base.models import Markdownizable
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class Gymnast(Markdownizable):
|
||||
"""Représente un gymnaste.
|
||||
|
@ -207,9 +209,8 @@ class Accident(Markdownizable):
|
|||
date = models.DateField(verbose_name="Date")
|
||||
|
||||
def __str__(self):
|
||||
return "%s, %s (%s)" % (
|
||||
self.gymnast.lastname,
|
||||
self.gymnast.firstname,
|
||||
return "%s(%s)" % (
|
||||
self.gymnast,
|
||||
self.date,
|
||||
)
|
||||
|
||||
|
@ -225,22 +226,6 @@ class CanDoRelation(models.Model):
|
|||
ordering = ["date", "educative", "gymnast"]
|
||||
unique_together = ("gymnast", "educative")
|
||||
|
||||
# TO_FRED : puis-je avoir ton avis là-dessus ?
|
||||
#
|
||||
# JE VAIS INDIQUER QUE DES ELEVES SAVENT FAIRE DES FIGURES (SKILL)
|
||||
#
|
||||
#
|
||||
# QUESTIONS
|
||||
# ---------
|
||||
#
|
||||
# 1) Cela ne dervait pas être deux relations ManyToMany dans chacune des tables GYMNAST et EDUCATIVE (ou SKILL) ?
|
||||
# Un élève saura faire plusieurs figures.
|
||||
# Et une figure pourra savoir être faite par plusieurs élèves... Donc, ?
|
||||
#
|
||||
# 2) Dans un premier temps, même si je l'appelle EDUCATIVE mon champs, pour être pérenne,
|
||||
# je n'associerai QUE des figures à un élève. Je voudrais donc, dans l'admin, que mon champs
|
||||
# ne soit populer qu'avec les éléments de la table SKILL et non pas tous les éléments de la
|
||||
# table EDUCATIVE.
|
||||
gymnast = models.ForeignKey(
|
||||
Gymnast,
|
||||
verbose_name="Gymnast",
|
||||
|
@ -256,9 +241,8 @@ class CanDoRelation(models.Model):
|
|||
date = models.DateField(default=date.today, verbose_name="Date")
|
||||
|
||||
def __str__(self):
|
||||
return "%s, %s - %s" % (
|
||||
self.gymnast.user.last_name,
|
||||
self.gymnast.user.first_name,
|
||||
return "%s - %s" % (
|
||||
self.gymnast,
|
||||
self.educative.shortLabel,
|
||||
)
|
||||
|
||||
|
@ -295,10 +279,9 @@ class ToDoRelation(models.Model):
|
|||
date = models.DateField(default=date.today, verbose_name="Date")
|
||||
|
||||
def __str__(self):
|
||||
return "%s, %s - %s" % (
|
||||
self.gymnast.lastname,
|
||||
self.gymnast.firstname,
|
||||
self.educative.shortLabel,
|
||||
return "%s - %s" % (
|
||||
self.gymnast,
|
||||
self.educative.short_label,
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
# coding=utf-8
|
||||
|
||||
from django.shortcuts import get_object_or_404
|
||||
from django import template
|
||||
|
||||
from khana.eople.models import Gymnast
|
||||
from khana.people.models import Gymnast
|
||||
|
||||
from khana.objective.models import Skill
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
# coding=UTF-8
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db.models import Q, Count, Min
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.template import RequestContext
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.views.decorators.cache import cache_page
|
||||
|
||||
|
@ -13,10 +12,11 @@ import pendulum
|
|||
|
||||
from .forms import AccidentForm, GymnastForm, GymnastHasRoutineForm, UserForm
|
||||
from .models import Gymnast, Accident, CanDoRelation
|
||||
from planning.models import Event
|
||||
from planning.views import suggest_program
|
||||
from objective.models import Educative, Skill, Chrono
|
||||
from competition.models import Point
|
||||
|
||||
from khana.competition.models import Point
|
||||
from khana.planning.models import Event
|
||||
from khana.planning.views import suggest_program
|
||||
from khana.objective.models import Educative, Skill, Chrono
|
||||
|
||||
|
||||
@login_required
|
||||
|
@ -171,12 +171,12 @@ def gymnast_create_or_update(request, gymnastid=None):
|
|||
|
||||
if request.method == "POST":
|
||||
user_form = UserForm(request.POST, instance=gymnast.user)
|
||||
user_form["username"] = user_form["first_name"] + "_" + user_form["last_name"]
|
||||
#user_form["username"] = user_form["first_name"] + "_" + user_form["last_name"]
|
||||
gymnast_form = GymnastForm(request.POST, instance=gymnast)
|
||||
|
||||
if user_form.is_valid():
|
||||
user = user_form.save()
|
||||
gymnast_form["user"] = user
|
||||
#gymnast_form["user"] = user
|
||||
|
||||
if gymnast_form.is_valid():
|
||||
gymnast = gymnast_form.save()
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
|
||||
from datetime import date
|
||||
|
||||
from django import forms
|
||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||
|
||||
from people.models import Gymnast
|
||||
from khana.people.models import Gymnast
|
||||
from .models import Unavailability, Event, PlanningLine
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from datetime import datetime, date, time, timedelta
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
|
||||
|
@ -11,6 +11,9 @@ from khana.location.models import Club
|
|||
from khana.people.models import Gymnast
|
||||
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
def get_week(a_date):
|
||||
"""
|
||||
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import (
|
||||
HttpResponseRedirect,
|
||||
HttpResponse,
|
||||
) # <== TO_FRED : PQ C'EST LA CA ???
|
||||
from django.template import RequestContext
|
||||
|
||||
from calendar import monthrange
|
||||
from datetime import datetime, date, timedelta
|
||||
|
||||
from django.core import serializers
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.db import connection
|
||||
from django.db.models import Max, Min
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.template import RequestContext
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.utils import timezone
|
||||
from django.views.decorators.http import require_http_methods
|
||||
from django.db.models import Max, Min
|
||||
from django.core import serializers
|
||||
from django.db import connection
|
||||
|
||||
from people.models import Gymnast, ToDoRelation
|
||||
from khana.objective.models import Chrono, Skill
|
||||
from khana.people.models import Gymnast, ToDoRelation, User
|
||||
|
||||
from .models import (
|
||||
Season,
|
||||
Course,
|
||||
|
@ -26,12 +29,9 @@ from .models import (
|
|||
get_number_of_weeks_between,
|
||||
get_week,
|
||||
)
|
||||
from .forms import UnavailabilityForm, EventForm, PlanningLineForm
|
||||
from people.models import User
|
||||
from objective.models import Chrono, Skill
|
||||
|
||||
from calendar import monthrange
|
||||
from datetime import datetime, date, timedelta
|
||||
from .forms import UnavailabilityForm, EventForm, PlanningLineForm
|
||||
|
||||
|
||||
import pendulum
|
||||
import simplejson
|
||||
|
@ -81,6 +81,9 @@ def event_create_or_update(request, eventid=None):
|
|||
complètement le GET du POST.
|
||||
"""
|
||||
|
||||
if eventid:
|
||||
event = get_object_or_404(Event, pk=eventid)
|
||||
|
||||
if request.method == "POST":
|
||||
form = EventForm(request.POST, instance=event)
|
||||
|
||||
|
|
|
@ -7,10 +7,12 @@ Les profils peuvent enregistrer les informations suivantes:
|
|||
* si la barre de navigation doit être cachée ou non
|
||||
"""
|
||||
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db import models
|
||||
from django.dispatch import receiver
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
class Profile(models.Model):
|
||||
"""Classe étendant les informations des utilisateurs/entraineurs de l'application.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"""Vues de gestion des profils utilisateurs."""
|
||||
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth.models import User
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.db.models import Q
|
||||
from django.http import HttpResponseRedirect, HttpResponse
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
|
@ -12,6 +12,8 @@ import simplejson
|
|||
from .forms import ProfileForm
|
||||
from .models import Profile
|
||||
|
||||
User = get_user_model()
|
||||
|
||||
|
||||
@login_required
|
||||
@require_http_methods(["GET"])
|
||||
|
|
Loading…
Reference in New Issue