forked from DGNum/gestioCOF
Update Py3 compat
This commit is contained in:
parent
aa6e5e5479
commit
210c6d7712
27 changed files with 155 additions and 95 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
WSGI config for myproject project.
|
WSGI config for myproject project.
|
||||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
@ -5,6 +7,10 @@ For more information on this file, see
|
||||||
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
|
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
|
10
bda/admin.py
10
bda/admin.py
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.core.mail import send_mail
|
from django.core.mail import send_mail
|
||||||
|
@ -87,7 +89,7 @@ Le Bureau des Arts
|
||||||
name = member.user.get_full_name()
|
name = member.user.get_full_name()
|
||||||
mail = mail % name
|
mail = mail % name
|
||||||
else:
|
else:
|
||||||
mail = u"""Cher-e %s,
|
mail = """Cher-e %s,
|
||||||
|
|
||||||
Tu t'es inscrit-e pour le tirage au sort du BdA. Tu as été sélectionné-e
|
Tu t'es inscrit-e pour le tirage au sort du BdA. Tu as été sélectionné-e
|
||||||
pour les spectacles suivants :
|
pour les spectacles suivants :
|
||||||
|
@ -149,8 +151,8 @@ class AttributionAdminForm(forms.ModelForm):
|
||||||
if participant and spectacle:
|
if participant and spectacle:
|
||||||
if participant.tirage != spectacle.tirage:
|
if participant.tirage != spectacle.tirage:
|
||||||
raise forms.ValidationError(
|
raise forms.ValidationError(
|
||||||
u"Erreur : le participant et le spectacle n'appartiennent"
|
"Erreur : le participant et le spectacle n'appartiennent"
|
||||||
u"pas au même tirage")
|
"pas au même tirage")
|
||||||
return cleaned_data
|
return cleaned_data
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db.models import Max
|
from django.db.models import Max
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import calendar
|
import calendar
|
||||||
|
@ -140,6 +142,7 @@ DOUBLE_CHOICES = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class ChoixSpectacle(models.Model):
|
class ChoixSpectacle(models.Model):
|
||||||
participant = models.ForeignKey(Participant)
|
participant = models.ForeignKey(Participant)
|
||||||
spectacle = models.ForeignKey(Spectacle, related_name="participants")
|
spectacle = models.ForeignKey(Spectacle, related_name="participants")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
This file demonstrates writing tests using the unittest module. These will pass
|
This file demonstrates writing tests using the unittest module. These will pass
|
||||||
when you run "manage.py test".
|
when you run "manage.py test".
|
||||||
|
@ -5,6 +6,11 @@ when you run "manage.py test".
|
||||||
Replace this with more appropriate tests for your application.
|
Replace this with more appropriate tests for your application.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
from bda.views import SpectacleListView
|
from bda.views import SpectacleListView
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import division
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.shortcuts import render, get_object_or_404
|
from django.shortcuts import render, get_object_or_404
|
||||||
|
@ -195,7 +196,7 @@ def do_tirage(request, tirage_id):
|
||||||
tirage_elt = get_object_or_404(Tirage, id=tirage_id)
|
tirage_elt = get_object_or_404(Tirage, id=tirage_id)
|
||||||
form = TokenForm(request.POST)
|
form = TokenForm(request.POST)
|
||||||
if not form.is_valid():
|
if not form.is_valid():
|
||||||
return tirage(request)
|
return tirage(request, tirage_id)
|
||||||
tirage_elt.token = form.cleaned_data['token']
|
tirage_elt.token = form.cleaned_data['token']
|
||||||
tirage_elt.save()
|
tirage_elt.save()
|
||||||
start = time.time()
|
start = time.time()
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
# -*-coding:utf-8 -*
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Django settings for cof project.
|
Django settings for cof project.
|
||||||
|
|
||||||
|
@ -10,6 +9,10 @@ For the full list of settings and their values, see
|
||||||
https://docs.djangoproject.com/en/1.8/ref/settings/
|
https://docs.djangoproject.com/en/1.8/ref/settings/
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
14
cof/urls.py
14
cof/urls.py
|
@ -1,17 +1,17 @@
|
||||||
# -*-coding:utf-8 -*
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.conf.urls import patterns, include, url
|
from django.conf.urls import patterns, include, url
|
||||||
from django.conf.urls.static import static
|
from django.conf.urls.static import static
|
||||||
|
from django.contrib import admin
|
||||||
|
from django.views.generic.base import TemplateView
|
||||||
|
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
|
|
||||||
from django.contrib import admin
|
|
||||||
|
|
||||||
from django.views.generic.base import TemplateView
|
|
||||||
|
|
||||||
from gestioncof.urls import export_patterns, petitcours_patterns, \
|
from gestioncof.urls import export_patterns, petitcours_patterns, \
|
||||||
surveys_patterns, events_patterns
|
surveys_patterns, events_patterns
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ urlpatterns = patterns(
|
||||||
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
|
url(r'^utile_bda/bda_revente$', 'gestioncof.views.liste_bdarevente'),
|
||||||
) + \
|
) + \
|
||||||
(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
(static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
if settings.DEBUG
|
if settings.DEBUG
|
||||||
else [])
|
else [])
|
||||||
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
# Si on est en production, MEDIA_ROOT est servi par Apache.
|
||||||
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
# Il faut dire à Django de servir MEDIA_ROOT lui-même en développement.
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
@ -15,8 +17,8 @@ import django.utils.six as six
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
|
|
||||||
|
|
||||||
def add_link_field(target_model='', field='', link_text=unicode,
|
def add_link_field(target_model='', field='', link_text=six.text_type,
|
||||||
desc_text=unicode):
|
desc_text=six.text_type):
|
||||||
def add_link(cls):
|
def add_link(cls):
|
||||||
reverse_name = target_model or cls.model.__name__.lower()
|
reverse_name = target_model or cls.model.__name__.lower()
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django import shortcuts
|
from django import shortcuts
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import autocomplete_light
|
import autocomplete_light
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django_cas_ng.decorators import user_passes_test
|
from django_cas_ng.decorators import user_passes_test
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -34,24 +36,21 @@ TYPE_COMMENT_FIELD = (
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def choices_length(choices):
|
@python_2_unicode_compatible
|
||||||
return reduce(lambda m, choice: max(m, len(choice[0])), choices, 0)
|
|
||||||
|
|
||||||
|
|
||||||
class CofProfile(models.Model):
|
class CofProfile(models.Model):
|
||||||
user = models.OneToOneField(User, related_name="profile")
|
user = models.OneToOneField(User, related_name="profile")
|
||||||
login_clipper = models.CharField("Login clipper", max_length=8, blank=True)
|
login_clipper = models.CharField("Login clipper", max_length=8, blank=True)
|
||||||
is_cof = models.BooleanField("Membre du COF", default=False)
|
is_cof = models.BooleanField("Membre du COF", default=False)
|
||||||
num = models.IntegerField("Numéro d'adhérent", blank=True, default=0)
|
num = models.IntegerField("Numéro d'adhérent", blank=True, default=0)
|
||||||
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
phone = models.CharField("Téléphone", max_length=20, blank=True)
|
||||||
occupation = models.CharField(_(u"Occupation"),
|
occupation = models.CharField(_("Occupation"),
|
||||||
default="1A",
|
default="1A",
|
||||||
choices=OCCUPATION_CHOICES,
|
choices=OCCUPATION_CHOICES,
|
||||||
max_length=choices_length(
|
max_length=choices_length(
|
||||||
OCCUPATION_CHOICES))
|
OCCUPATION_CHOICES))
|
||||||
departement = models.CharField(_(u"Département"), max_length=50,
|
departement = models.CharField(_("Département"), max_length=50,
|
||||||
blank=True)
|
blank=True)
|
||||||
type_cotiz = models.CharField(_(u"Type de cotisation"),
|
type_cotiz = models.CharField(_("Type de cotisation"),
|
||||||
default="normalien",
|
default="normalien",
|
||||||
choices=TYPE_COTIZ_CHOICES,
|
choices=TYPE_COTIZ_CHOICES,
|
||||||
max_length=choices_length(
|
max_length=choices_length(
|
||||||
|
@ -83,6 +82,7 @@ def create_user_profile(sender, instance, created, **kwargs):
|
||||||
post_save.connect(create_user_profile, sender=User)
|
post_save.connect(create_user_profile, sender=User)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Club(models.Model):
|
class Club(models.Model):
|
||||||
name = models.CharField("Nom", max_length=200)
|
name = models.CharField("Nom", max_length=200)
|
||||||
description = models.TextField("Description")
|
description = models.TextField("Description")
|
||||||
|
@ -141,6 +141,7 @@ class EventCommentField(models.Model):
|
||||||
return six.text_type(self.name)
|
return six.text_type(self.name)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class EventCommentValue(models.Model):
|
class EventCommentValue(models.Model):
|
||||||
commentfield = models.ForeignKey(EventCommentField, related_name="values")
|
commentfield = models.ForeignKey(EventCommentField, related_name="values")
|
||||||
registration = models.ForeignKey("EventRegistration",
|
registration = models.ForeignKey("EventRegistration",
|
||||||
|
@ -187,9 +188,9 @@ class EventRegistration(models.Model):
|
||||||
verbose_name = "Inscription"
|
verbose_name = "Inscription"
|
||||||
unique_together = ("user", "event")
|
unique_together = ("user", "event")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"Inscription de %s à %s" % (unicode(self.user),
|
return "Inscription de %s à %s" % (six.text_type(self.user),
|
||||||
unicode(self.event.title))
|
six.text_type(self.event.title))
|
||||||
|
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
|
@ -231,6 +232,7 @@ class SurveyQuestionAnswer(models.Model):
|
||||||
return six.text_type(self.answer)
|
return six.text_type(self.answer)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SurveyAnswer(models.Model):
|
class SurveyAnswer(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
survey = models.ForeignKey(Survey)
|
survey = models.ForeignKey(Survey)
|
||||||
|
@ -242,6 +244,7 @@ class SurveyAnswer(models.Model):
|
||||||
unique_together = ("user", "survey")
|
unique_together = ("user", "survey")
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Clipper(models.Model):
|
class Clipper(models.Model):
|
||||||
username = models.CharField("Identifiant", max_length=20)
|
username = models.CharField("Identifiant", max_length=20)
|
||||||
fullname = models.CharField("Nom complet", max_length=200)
|
fullname = models.CharField("Nom complet", max_length=200)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -39,11 +41,11 @@ class PetitCoursSubject(models.Model):
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class PetitCoursAbility(models.Model):
|
class PetitCoursAbility(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_(u"Matière"))
|
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_("Matière"))
|
||||||
niveau = models.CharField(_(u"Niveau"),
|
niveau = models.CharField(_("Niveau"),
|
||||||
choices=LEVELS_CHOICES,
|
choices=LEVELS_CHOICES,
|
||||||
max_length=choices_length(LEVELS_CHOICES))
|
max_length=choices_length(LEVELS_CHOICES))
|
||||||
agrege = models.BooleanField(_(u"Agrégé"), default=False)
|
agrege = models.BooleanField(_("Agrégé"), default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Compétence petits cours"
|
verbose_name = "Compétence petits cours"
|
||||||
|
@ -56,41 +58,41 @@ class PetitCoursAbility(models.Model):
|
||||||
|
|
||||||
@python_2_unicode_compatible
|
@python_2_unicode_compatible
|
||||||
class PetitCoursDemande(models.Model):
|
class PetitCoursDemande(models.Model):
|
||||||
name = models.CharField(_(u"Nom/prénom"), max_length=200)
|
name = models.CharField(_("Nom/prénom"), max_length=200)
|
||||||
email = models.CharField(_(u"Adresse email"), max_length=300)
|
email = models.CharField(_("Adresse email"), max_length=300)
|
||||||
phone = models.CharField(_(u"Téléphone (facultatif)"),
|
phone = models.CharField(_("Téléphone (facultatif)"),
|
||||||
max_length=20, blank=True)
|
max_length=20, blank=True)
|
||||||
quand = models.CharField(
|
quand = models.CharField(
|
||||||
_(u"Quand ?"),
|
_("Quand ?"),
|
||||||
help_text=_(u"Indiquez ici la période désirée pour les petits"
|
help_text=_("Indiquez ici la période désirée pour les petits"
|
||||||
" cours (vacances scolaires, semaine, week-end)."),
|
" cours (vacances scolaires, semaine, week-end)."),
|
||||||
max_length=300, blank=True)
|
max_length=300, blank=True)
|
||||||
freq = models.CharField(
|
freq = models.CharField(
|
||||||
_(u"Fréquence"),
|
_("Fréquence"),
|
||||||
help_text=_(u"Indiquez ici la fréquence envisagée "
|
help_text=_("Indiquez ici la fréquence envisagée "
|
||||||
+ "(hebdomadaire, 2 fois par semaine, ...)"),
|
+ "(hebdomadaire, 2 fois par semaine, ...)"),
|
||||||
max_length=300, blank=True)
|
max_length=300, blank=True)
|
||||||
lieu = models.CharField(
|
lieu = models.CharField(
|
||||||
_(u"Lieu (si préférence)"),
|
_("Lieu (si préférence)"),
|
||||||
help_text=_(u"Si vous avez avez une préférence sur le lieu."),
|
help_text=_("Si vous avez avez une préférence sur le lieu."),
|
||||||
max_length=300, blank=True)
|
max_length=300, blank=True)
|
||||||
|
|
||||||
matieres = models.ManyToManyField(
|
matieres = models.ManyToManyField(
|
||||||
PetitCoursSubject, verbose_name=_(u"Matières"),
|
PetitCoursSubject, verbose_name=_("Matières"),
|
||||||
related_name="demandes")
|
related_name="demandes")
|
||||||
agrege_requis = models.BooleanField(_(u"Agrégé requis"), default=False)
|
agrege_requis = models.BooleanField(_("Agrégé requis"), default=False)
|
||||||
niveau = models.CharField(_(u"Niveau"),
|
niveau = models.CharField(_("Niveau"),
|
||||||
default="",
|
default="",
|
||||||
choices=LEVELS_CHOICES,
|
choices=LEVELS_CHOICES,
|
||||||
max_length=choices_length(LEVELS_CHOICES))
|
max_length=choices_length(LEVELS_CHOICES))
|
||||||
|
|
||||||
remarques = models.TextField(_(u"Remarques et précisions"), blank=True)
|
remarques = models.TextField(_("Remarques et précisions"), blank=True)
|
||||||
|
|
||||||
traitee = models.BooleanField(_(u"Traitée"), default=False)
|
traitee = models.BooleanField(_("Traitée"), default=False)
|
||||||
traitee_par = models.ForeignKey(User, blank=True, null=True)
|
traitee_par = models.ForeignKey(User, blank=True, null=True)
|
||||||
processed = models.DateTimeField(_(u"Date de traitement"),
|
processed = models.DateTimeField(_("Date de traitement"),
|
||||||
blank=True, null=True)
|
blank=True, null=True)
|
||||||
created = models.DateTimeField(_(u"Date de création"), auto_now_add=True)
|
created = models.DateTimeField(_("Date de création"), auto_now_add=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
verbose_name = "Demande de petits cours"
|
verbose_name = "Demande de petits cours"
|
||||||
|
@ -105,10 +107,10 @@ class PetitCoursDemande(models.Model):
|
||||||
class PetitCoursAttribution(models.Model):
|
class PetitCoursAttribution(models.Model):
|
||||||
user = models.ForeignKey(User)
|
user = models.ForeignKey(User)
|
||||||
demande = models.ForeignKey(PetitCoursDemande, verbose_name=_("Demande"))
|
demande = models.ForeignKey(PetitCoursDemande, verbose_name=_("Demande"))
|
||||||
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_(u"Matière"))
|
matiere = models.ForeignKey(PetitCoursSubject, verbose_name=_("Matière"))
|
||||||
date = models.DateTimeField(_(u"Date d'attribution"), auto_now_add=True)
|
date = models.DateTimeField(_("Date d'attribution"), auto_now_add=True)
|
||||||
rank = models.IntegerField("Rang dans l'email")
|
rank = models.IntegerField("Rang dans l'email")
|
||||||
selected = models.BooleanField(_(u"Sélectionné par le demandeur"),
|
selected = models.BooleanField(_("Sélectionné par le demandeur"),
|
||||||
default=False)
|
default=False)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -116,7 +118,7 @@ class PetitCoursAttribution(models.Model):
|
||||||
verbose_name_plural = "Attributions de petits cours"
|
verbose_name_plural = "Attributions de petits cours"
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return u"Attribution de la demande %d à %s pour %s" \
|
return "Attribution de la demande %d à %s pour %s" \
|
||||||
% (self.demande.id, self.user.username, self.matiere)
|
% (self.demande.id, self.user.username, self.matiere)
|
||||||
|
|
||||||
|
|
||||||
|
@ -130,6 +132,6 @@ class PetitCoursAttributionCounter(models.Model):
|
||||||
verbose_name = "Compteur d'attribution de petits cours"
|
verbose_name = "Compteur d'attribution de petits cours"
|
||||||
verbose_name_plural = "Compteurs d'attributions de petits cours"
|
verbose_name_plural = "Compteurs d'attributions de petits cours"
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return "%d demandes envoyées à %s pour %s" \
|
return "%d demandes envoyées à %s pour %s" \
|
||||||
% (self.count, self.user.username, self.matiere)
|
% (self.count, self.user.username, self.matiere)
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.shortcuts import render, get_object_or_404, redirect
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
|
@ -183,12 +185,12 @@ def _traitement_other_preparing(request, demande):
|
||||||
if choice == -1:
|
if choice == -1:
|
||||||
continue
|
continue
|
||||||
if choice not in candidates:
|
if choice not in candidates:
|
||||||
errors.append(u"Choix invalide pour la proposition %d"
|
errors.append("Choix invalide pour la proposition %d"
|
||||||
"en %s" % (choice_id + 1, matiere))
|
"en %s" % (choice_id + 1, matiere))
|
||||||
continue
|
continue
|
||||||
user = candidates[choice]
|
user = candidates[choice]
|
||||||
if user in proposals[matiere]:
|
if user in proposals[matiere]:
|
||||||
errors.append(u"La proposition %d en %s est un doublon"
|
errors.append("La proposition %d en %s est un doublon"
|
||||||
% (choice_id + 1, matiere))
|
% (choice_id + 1, matiere))
|
||||||
continue
|
continue
|
||||||
proposals[matiere].append(user)
|
proposals[matiere].append(user)
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib.sites.models import Site
|
from django.contrib.sites.models import Site
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django_cas_ng.backends import CASBackend
|
from django_cas_ng.backends import CASBackend
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django import template
|
from django import template
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
"""
|
||||||
This file demonstrates writing tests using the unittest module. These will pass
|
This file demonstrates writing tests using the unittest module. These will pass
|
||||||
when you run "manage.py test".
|
when you run "manage.py test".
|
||||||
|
@ -5,6 +6,10 @@ when you run "manage.py test".
|
||||||
Replace this with more appropriate tests for your application.
|
Replace this with more appropriate tests for your application.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.conf.urls import url
|
from django.conf.urls import url
|
||||||
from gestioncof.petits_cours_views import DemandeListView
|
from gestioncof.petits_cours_views import DemandeListView
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
# coding: utf-8
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import unicodecsv
|
import unicodecsv
|
||||||
|
@ -280,35 +282,6 @@ def survey_status(request, survey_id):
|
||||||
"form": form})
|
"form": form})
|
||||||
|
|
||||||
|
|
||||||
class UserProfileForm(forms.ModelForm):
|
|
||||||
first_name = forms.CharField(label=_('Prénom'), max_length=30)
|
|
||||||
last_name = forms.CharField(label=_('Nom'), max_length=30)
|
|
||||||
|
|
||||||
def __init__(self, *args, **kw):
|
|
||||||
super(UserProfileForm, self).__init__(*args, **kw)
|
|
||||||
self.fields['first_name'].initial = self.instance.user.first_name
|
|
||||||
self.fields['last_name'].initial = self.instance.user.last_name
|
|
||||||
|
|
||||||
self.fields.keyOrder = [
|
|
||||||
'first_name',
|
|
||||||
'last_name',
|
|
||||||
'phone',
|
|
||||||
'mailing_cof',
|
|
||||||
'mailing_bda',
|
|
||||||
'mailing_bda_revente',
|
|
||||||
]
|
|
||||||
|
|
||||||
def save(self, *args, **kw):
|
|
||||||
super(UserProfileForm, self).save(*args, **kw)
|
|
||||||
self.instance.user.first_name = self.cleaned_data.get('first_name')
|
|
||||||
self.instance.user.last_name = self.cleaned_data.get('last_name')
|
|
||||||
self.instance.user.save()
|
|
||||||
|
|
||||||
class Meta:
|
|
||||||
model = CofProfile
|
|
||||||
fields = ("phone", "mailing_cof", "mailing_bda", "mailing_bda_revente",)
|
|
||||||
>>>>>>> Compatibilité python 3
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def profile(request):
|
def profile(request):
|
||||||
success = False
|
success = False
|
||||||
|
@ -523,7 +496,7 @@ def export_members(request):
|
||||||
bits = [profile.num, user.username, user.first_name, user.last_name,
|
bits = [profile.num, user.username, user.first_name, user.last_name,
|
||||||
user.email, profile.phone, profile.occupation,
|
user.email, profile.phone, profile.occupation,
|
||||||
profile.departement, profile.type_cotiz]
|
profile.departement, profile.type_cotiz]
|
||||||
writer.writerow([unicode(bit) for bit in bits])
|
writer.writerow([six.text_type(bit) for bit in bits])
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -543,7 +516,7 @@ def csv_export_mega(filename, qs):
|
||||||
profile.phone, profile.num,
|
profile.phone, profile.num,
|
||||||
profile.comments if profile.comments else "", comments]
|
profile.comments if profile.comments else "", comments]
|
||||||
|
|
||||||
writer.writerow([unicode(bit) for bit in bits])
|
writer.writerow([six.text_type(bit) for bit in bits])
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
@ -563,7 +536,7 @@ def export_mega_remarksonly(request):
|
||||||
profile = user.profile
|
profile = user.profile
|
||||||
bits = [user.username, user.first_name, user.last_name, user.email,
|
bits = [user.username, user.first_name, user.last_name, user.email,
|
||||||
profile.phone, profile.num, profile.comments, val.content]
|
profile.phone, profile.num, profile.comments, val.content]
|
||||||
writer.writerow([unicode(bit) for bit in bits])
|
writer.writerow([six.text_type(bit) for bit in bits])
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.forms.widgets import Widget
|
from django.forms.widgets import Widget
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import print_function, unicode_literals
|
from __future__ import division
|
||||||
|
from __future__ import print_function
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue