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",
|
"total",
|
||||||
)
|
)
|
||||||
ordering = ("gymnast",)
|
ordering = ("gymnast",)
|
||||||
# search_fields = ('longLabel', 'shortLabel')
|
|
||||||
list_filter = ("gymnast", "event", "routine_type")
|
list_filter = ("gymnast", "event", "routine_type")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# coding=UTF-8
|
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
|
@ -14,7 +13,6 @@ class Point(models.Model):
|
||||||
"people.Gymnast", on_delete=models.CASCADE, default=None
|
"people.Gymnast", on_delete=models.CASCADE, default=None
|
||||||
)
|
)
|
||||||
event = models.ForeignKey("planning.Event", 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)
|
routine_type = models.PositiveSmallIntegerField(choices=ROUTINETYPE_CHOICE)
|
||||||
point_execution = models.DecimalField(max_digits=5, decimal_places=3)
|
point_execution = models.DecimalField(max_digits=5, decimal_places=3)
|
||||||
point_difficulty = models.DecimalField(max_digits=3, decimal_places=1)
|
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)
|
total = models.DecimalField(max_digits=6, decimal_places=3)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s, %s - %s" % (
|
return "%s - %s" % (
|
||||||
self.gymnast.lastname,
|
self.gymnast,
|
||||||
self.gymnast.firstname,
|
|
||||||
self.total,
|
self.total,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# coding=UTF-8
|
|
||||||
|
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.contrib.auth.decorators import login_required
|
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.views.decorators.http import require_http_methods
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
from khana.people.models import Gymnast
|
||||||
|
|
||||||
from .forms import ScoreForm
|
from .forms import ScoreForm
|
||||||
from .models import Point
|
from .models import Point
|
||||||
from people.models import Gymnast
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@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 datetime import datetime, timedelta, date
|
||||||
from functools import reduce
|
from functools import reduce
|
||||||
import operator
|
import operator
|
||||||
import simplejson
|
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,
|
Event,
|
||||||
Unavailability,
|
Unavailability,
|
||||||
Course,
|
Course,
|
||||||
Subgroup,
|
Subgroup,
|
||||||
Training,
|
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 (
|
from .models import (
|
||||||
Club,
|
Club,
|
||||||
Place,
|
Place,
|
||||||
Country,
|
Country,
|
||||||
)
|
)
|
||||||
from .forms import PlaceForm
|
from .forms import PlaceForm
|
||||||
from objective.models import Skill, Routine # objective model
|
|
||||||
|
|
||||||
|
|
||||||
def __diffTime(end, start):
|
def __diffTime(end, start):
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
|
|
||||||
import math
|
import math
|
||||||
|
|
||||||
from people.models import Gymnast
|
from khana.people.models import Gymnast
|
||||||
from objectives.models import Skill
|
from khana.objective.models import Skill
|
||||||
|
|
||||||
|
|
||||||
def suggest_routine(
|
def suggest_routine(
|
||||||
|
@ -22,7 +23,7 @@ def suggest_routine(
|
||||||
logic (bool): indique si la série doit suivre certaines règles de logique (sportive).
|
logic (bool): indique si la série doit suivre certaines règles de logique (sportive).
|
||||||
gymnast (gymnast): gymnaste.
|
gymnast (gymnast): gymnaste.
|
||||||
last_jump (skill): dernier saut sélectionné pour la série.
|
last_jump (skill): dernier saut sélectionné pour la série.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
??? (list): liste des séries correspondantes aux criètres.
|
??? (list): liste des séries correspondantes aux criètres.
|
||||||
"""
|
"""
|
||||||
|
@ -58,16 +59,17 @@ def suggest_routine(
|
||||||
for skill in skill_list:
|
for skill in skill_list:
|
||||||
current_routine.append(skill)
|
current_routine.append(skill)
|
||||||
current_routine.append(
|
current_routine.append(
|
||||||
self.suggest_routine(
|
None
|
||||||
request,
|
# suggest_routine()
|
||||||
total_difficulty_score - skill.difficulty,
|
# request,
|
||||||
max_difficulty_score,
|
# total_difficulty_score - skill.difficulty,
|
||||||
routine_length - 1,
|
# max_difficulty_score,
|
||||||
competition,
|
# routine_length - 1,
|
||||||
logic,
|
# competition,
|
||||||
gymnast,
|
# logic,
|
||||||
skill,
|
# gymnast,
|
||||||
)
|
# skill,
|
||||||
|
# )
|
||||||
)
|
)
|
||||||
current_routine.pop()
|
current_routine.pop()
|
||||||
# def knapSack(W, wt, val, n):
|
# def knapSack(W, wt, val, n):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
# Register your models here.
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Educative,
|
Educative,
|
||||||
TouchPosition,
|
TouchPosition,
|
||||||
|
@ -30,10 +30,6 @@ def duplicate_skill(self, SkillAdmin, request, queryset):
|
||||||
class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
||||||
model = Skill
|
model = Skill
|
||||||
|
|
||||||
# related_search_fields = {
|
|
||||||
# 'departure': ('label', 'short_label'),
|
|
||||||
# 'landing': ('label', 'short_label')
|
|
||||||
# }
|
|
||||||
fields = (
|
fields = (
|
||||||
"label",
|
"label",
|
||||||
"short_label",
|
"short_label",
|
||||||
|
@ -66,7 +62,7 @@ class SkillAdmin(ForeignKeyAutocompleteAdmin):
|
||||||
"age_boy",
|
"age_boy",
|
||||||
"age_girl",
|
"age_girl",
|
||||||
)
|
)
|
||||||
# list_display = ('label', 'short_label', 'prerequisite')
|
|
||||||
ordering = ("label", "short_label")
|
ordering = ("label", "short_label")
|
||||||
search_fields = ("rank", "label", "short_label")
|
search_fields = ("rank", "label", "short_label")
|
||||||
list_filter = (
|
list_filter = (
|
||||||
|
@ -127,10 +123,10 @@ class RoutineAdmin(admin.ModelAdmin):
|
||||||
js = ("js/routine.js",)
|
js = ("js/routine.js",)
|
||||||
|
|
||||||
# TODO: ne proposer QUE les SKILL comme educatif
|
# TODO: ne proposer QUE les SKILL comme educatif
|
||||||
def get_related_filter(self, model, request):
|
# def get_related_filter(self, model, request):
|
||||||
# print('boum')
|
# # print('boum')
|
||||||
if not issubclass(model, Educative):
|
# if not issubclass(model, Educative):
|
||||||
return super(Skill, self).get_related_filter(model, request)
|
# return super(Skill, self).get_related_filter(model, request)
|
||||||
|
|
||||||
|
|
||||||
class RoutineSkillAdmin(admin.ModelAdmin):
|
class RoutineSkillAdmin(admin.ModelAdmin):
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
# coding=UTF-8
|
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
from khana.base.models import Markdownizable
|
from khana.base.models import Markdownizable
|
||||||
from django.contrib.auth.models import User
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Educative(Markdownizable):
|
class Educative(Markdownizable):
|
||||||
|
@ -40,7 +43,7 @@ class Educative(Markdownizable):
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s - %s (level: %s | diff: %s)" % (
|
return "%s - %s (level: %s | diff: %s)" % (
|
||||||
self.rank,
|
self.rank,
|
||||||
self.longLabel,
|
self.label,
|
||||||
self.level,
|
self.level,
|
||||||
self.difficulty,
|
self.difficulty,
|
||||||
)
|
)
|
||||||
|
@ -62,7 +65,7 @@ class TouchPosition(models.Model):
|
||||||
is_default = models.BooleanField(verbose_name="Défaut")
|
is_default = models.BooleanField(verbose_name="Défaut")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s" % (self.longLabel)
|
return "%s" % (self.label)
|
||||||
|
|
||||||
|
|
||||||
def get_default_position():
|
def get_default_position():
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# coding=UTF-8
|
|
||||||
|
|
||||||
from django.urls import reverse
|
|
||||||
from django.test import TestCase, Client
|
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
|
from .views import link_skill_to_routine
|
||||||
|
|
||||||
|
|
||||||
|
@ -51,4 +50,4 @@ class RoutineTest(TestCase):
|
||||||
|
|
||||||
# print(response)
|
# print(response)
|
||||||
self.assertEquals(response.status_code, 200)
|
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 datetime import datetime
|
||||||
from django.shortcuts import render, get_object_or_404
|
import math
|
||||||
from django.template import RequestContext
|
import random
|
||||||
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
|
|
||||||
|
|
||||||
import simplejson
|
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 .models import Skill, Educative, Routine, Chrono, RoutineSkill
|
||||||
from .forms import RoutineForm, ChronoForm
|
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):
|
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
|
:param lookup_class: classe fille dans laquelle la recherche doit être
|
||||||
faite.
|
faite.
|
||||||
:type lookup_class: string (`skill` ou `routine`).
|
:type lookup_class: string (`skill` ou `routine`).ùpdem
|
||||||
:param lookup_value: pattern de recherche.
|
:param lookup_value: pattern de recherche.
|
||||||
:type lookup_value: string.
|
:type lookup_value: string.
|
||||||
|
|
||||||
|
@ -372,7 +370,7 @@ def __construct_routine(
|
||||||
competition (bool): indique si la série doit respecter les règles de compétition.
|
competition (bool): indique si la série doit respecter les règles de compétition.
|
||||||
logic (bool): indique si la série doit suivre les règles de logique (sportive).
|
logic (bool): indique si la série doit suivre les règles de logique (sportive).
|
||||||
gymnast (gymnast): gymnaste.
|
gymnast (gymnast): gymnaste.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
??? (list ?): liste des séries correspondantes aux criètres.
|
??? (list ?): liste des séries correspondantes aux criètres.
|
||||||
"""
|
"""
|
||||||
|
@ -471,7 +469,7 @@ def suggest_routine(
|
||||||
logic (bool): indique si la série doit suivre les règles de logique (sportive).
|
logic (bool): indique si la série doit suivre les règles de logique (sportive).
|
||||||
gymnast (gymnast): gymnaste.
|
gymnast (gymnast): gymnaste.
|
||||||
last_jump (skill): dernier saut sélectionné pour la série.
|
last_jump (skill): dernier saut sélectionné pour la série.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
??? (list): liste des séries correspondantes aux criètres.
|
??? (list): liste des séries correspondantes aux criètres.
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
"""Formulaires de gestion des données entrantes pour les gymnastes et accidents."""
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
from django.contrib.auth import get_user_model
|
||||||
|
|
||||||
from .models import (
|
from .models import (
|
||||||
Accident,
|
Accident,
|
||||||
|
@ -8,7 +9,7 @@ from .models import (
|
||||||
GymnastHasRoutine,
|
GymnastHasRoutine,
|
||||||
)
|
)
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class AccidentForm(forms.ModelForm):
|
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 datetime import date
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth import get_user_model
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
|
||||||
import pendulum
|
import pendulum
|
||||||
|
|
||||||
from khana.base.models import Markdownizable
|
from khana.base.models import Markdownizable
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Gymnast(Markdownizable):
|
class Gymnast(Markdownizable):
|
||||||
"""Représente un gymnaste.
|
"""Représente un gymnaste.
|
||||||
|
@ -207,9 +209,8 @@ class Accident(Markdownizable):
|
||||||
date = models.DateField(verbose_name="Date")
|
date = models.DateField(verbose_name="Date")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s, %s (%s)" % (
|
return "%s(%s)" % (
|
||||||
self.gymnast.lastname,
|
self.gymnast,
|
||||||
self.gymnast.firstname,
|
|
||||||
self.date,
|
self.date,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -225,22 +226,6 @@ class CanDoRelation(models.Model):
|
||||||
ordering = ["date", "educative", "gymnast"]
|
ordering = ["date", "educative", "gymnast"]
|
||||||
unique_together = ("gymnast", "educative")
|
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 = models.ForeignKey(
|
||||||
Gymnast,
|
Gymnast,
|
||||||
verbose_name="Gymnast",
|
verbose_name="Gymnast",
|
||||||
|
@ -256,9 +241,8 @@ class CanDoRelation(models.Model):
|
||||||
date = models.DateField(default=date.today, verbose_name="Date")
|
date = models.DateField(default=date.today, verbose_name="Date")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s, %s - %s" % (
|
return "%s - %s" % (
|
||||||
self.gymnast.user.last_name,
|
self.gymnast,
|
||||||
self.gymnast.user.first_name,
|
|
||||||
self.educative.shortLabel,
|
self.educative.shortLabel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -295,10 +279,9 @@ class ToDoRelation(models.Model):
|
||||||
date = models.DateField(default=date.today, verbose_name="Date")
|
date = models.DateField(default=date.today, verbose_name="Date")
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "%s, %s - %s" % (
|
return "%s - %s" % (
|
||||||
self.gymnast.lastname,
|
self.gymnast,
|
||||||
self.gymnast.firstname,
|
self.educative.short_label,
|
||||||
self.educative.shortLabel,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
# coding=utf-8
|
|
||||||
|
|
||||||
from django.shortcuts import get_object_or_404
|
from django.shortcuts import get_object_or_404
|
||||||
from django import template
|
from django import template
|
||||||
|
|
||||||
from khana.eople.models import Gymnast
|
from khana.people.models import Gymnast
|
||||||
|
|
||||||
from khana.objective.models import Skill
|
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.db.models import Q, Count, Min
|
||||||
|
from django.http import HttpResponseRedirect, HttpResponse
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
from django.template import RequestContext
|
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.http import require_http_methods
|
||||||
from django.views.decorators.cache import cache_page
|
from django.views.decorators.cache import cache_page
|
||||||
|
|
||||||
|
@ -13,10 +12,11 @@ import pendulum
|
||||||
|
|
||||||
from .forms import AccidentForm, GymnastForm, GymnastHasRoutineForm, UserForm
|
from .forms import AccidentForm, GymnastForm, GymnastHasRoutineForm, UserForm
|
||||||
from .models import Gymnast, Accident, CanDoRelation
|
from .models import Gymnast, Accident, CanDoRelation
|
||||||
from planning.models import Event
|
|
||||||
from planning.views import suggest_program
|
from khana.competition.models import Point
|
||||||
from objective.models import Educative, Skill, Chrono
|
from khana.planning.models import Event
|
||||||
from competition.models import Point
|
from khana.planning.views import suggest_program
|
||||||
|
from khana.objective.models import Educative, Skill, Chrono
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
|
@ -171,12 +171,12 @@ def gymnast_create_or_update(request, gymnastid=None):
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
user_form = UserForm(request.POST, instance=gymnast.user)
|
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)
|
gymnast_form = GymnastForm(request.POST, instance=gymnast)
|
||||||
|
|
||||||
if user_form.is_valid():
|
if user_form.is_valid():
|
||||||
user = user_form.save()
|
user = user_form.save()
|
||||||
gymnast_form["user"] = user
|
#gymnast_form["user"] = user
|
||||||
|
|
||||||
if gymnast_form.is_valid():
|
if gymnast_form.is_valid():
|
||||||
gymnast = gymnast_form.save()
|
gymnast = gymnast_form.save()
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
|
||||||
from datetime import date
|
from datetime import date
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.contrib.admin.widgets import FilteredSelectMultiple
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
||||||
|
|
||||||
from people.models import Gymnast
|
from khana.people.models import Gymnast
|
||||||
from .models import Unavailability, Event, PlanningLine
|
from .models import Unavailability, Event, PlanningLine
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
from datetime import datetime, date, time, timedelta
|
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.db import models
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
@ -11,6 +11,9 @@ from khana.location.models import Club
|
||||||
from khana.people.models import Gymnast
|
from khana.people.models import Gymnast
|
||||||
|
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
def get_week(a_date):
|
def get_week(a_date):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,20 @@
|
||||||
from django.shortcuts import render, get_object_or_404
|
|
||||||
from django.http import (
|
from calendar import monthrange
|
||||||
HttpResponseRedirect,
|
from datetime import datetime, date, timedelta
|
||||||
HttpResponse,
|
|
||||||
) # <== TO_FRED : PQ C'EST LA CA ???
|
from django.core import serializers
|
||||||
from django.template import RequestContext
|
|
||||||
from django.contrib.auth.decorators import login_required
|
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.utils import timezone
|
||||||
from django.views.decorators.http import require_http_methods
|
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 (
|
from .models import (
|
||||||
Season,
|
Season,
|
||||||
Course,
|
Course,
|
||||||
|
@ -26,12 +29,9 @@ from .models import (
|
||||||
get_number_of_weeks_between,
|
get_number_of_weeks_between,
|
||||||
get_week,
|
get_week,
|
||||||
)
|
)
|
||||||
from .forms import UnavailabilityForm, EventForm, PlanningLineForm
|
|
||||||
from people.models import User
|
|
||||||
from objective.models import Chrono, Skill
|
|
||||||
|
|
||||||
from calendar import monthrange
|
from .forms import UnavailabilityForm, EventForm, PlanningLineForm
|
||||||
from datetime import datetime, date, timedelta
|
|
||||||
|
|
||||||
import pendulum
|
import pendulum
|
||||||
import simplejson
|
import simplejson
|
||||||
|
@ -81,6 +81,9 @@ def event_create_or_update(request, eventid=None):
|
||||||
complètement le GET du POST.
|
complètement le GET du POST.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if eventid:
|
||||||
|
event = get_object_or_404(Event, pk=eventid)
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
form = EventForm(request.POST, instance=event)
|
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
|
* 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.db import models
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
class Profile(models.Model):
|
class Profile(models.Model):
|
||||||
"""Classe étendant les informations des utilisateurs/entraineurs de l'application.
|
"""Classe étendant les informations des utilisateurs/entraineurs de l'application.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
"""Vues de gestion des profils utilisateurs."""
|
"""Vues de gestion des profils utilisateurs."""
|
||||||
|
|
||||||
from django.contrib.auth.decorators import login_required
|
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.db.models import Q
|
||||||
from django.http import HttpResponseRedirect, HttpResponse
|
from django.http import HttpResponseRedirect, HttpResponse
|
||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
|
@ -12,6 +12,8 @@ import simplejson
|
||||||
from .forms import ProfileForm
|
from .forms import ProfileForm
|
||||||
from .models import Profile
|
from .models import Profile
|
||||||
|
|
||||||
|
User = get_user_model()
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@require_http_methods(["GET"])
|
@require_http_methods(["GET"])
|
||||||
|
|
Loading…
Reference in New Issue