forked from DGNum/gestioCOF
cleanup
This commit is contained in:
parent
b9c2efaf0e
commit
5f29caec3c
|
@ -8,7 +8,6 @@ from datetime import timedelta
|
||||||
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms.models import BaseInlineFormSet
|
from django.forms.models import BaseInlineFormSet
|
||||||
from django.db.models import Q
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from bda.models import Attribution, Spectacle
|
from bda.models import Attribution, Spectacle
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import division
|
|
||||||
from __future__ import print_function
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
|
|
||||||
import calendar
|
import calendar
|
||||||
import random
|
import random
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
@ -108,7 +104,7 @@ class Spectacle(models.Model):
|
||||||
mails_data = [
|
mails_data = [
|
||||||
(
|
(
|
||||||
member[0].email,
|
member[0].email,
|
||||||
{'member': member[0],'nb_attr': member[1], 'show': self}
|
{'member': member[0], 'nb_attr': member[1], 'show': self}
|
||||||
)
|
)
|
||||||
for member in members.values()
|
for member in members.values()
|
||||||
]
|
]
|
||||||
|
|
21
bda/views.py
21
bda/views.py
|
@ -5,7 +5,13 @@ from __future__ import print_function
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from custommail.utils import send_mass_custom_mail, send_custom_mail
|
import hashlib
|
||||||
|
import time
|
||||||
|
from datetime import timedelta
|
||||||
|
|
||||||
|
from custommail.utils import (
|
||||||
|
send_mass_custom_mail, send_custom_mail, render_mail
|
||||||
|
)
|
||||||
|
|
||||||
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
|
||||||
|
@ -16,15 +22,10 @@ from django.forms.models import inlineformset_factory
|
||||||
from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
from django.http import HttpResponseBadRequest, HttpResponseRedirect
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
import hashlib
|
|
||||||
|
|
||||||
from django.template import loader
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from django.views.generic.list import ListView
|
from django.views.generic.list import ListView
|
||||||
|
|
||||||
import time
|
|
||||||
from datetime import timedelta
|
|
||||||
|
|
||||||
from gestioncof.decorators import cof_required, buro_required
|
from gestioncof.decorators import cof_required, buro_required
|
||||||
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
from bda.models import Spectacle, Participant, ChoixSpectacle, Attribution,\
|
||||||
Tirage, SpectacleRevente
|
Tirage, SpectacleRevente
|
||||||
|
@ -372,7 +373,7 @@ def revente(request, tirage_id):
|
||||||
@login_required
|
@login_required
|
||||||
def revente_interested(request, revente_id):
|
def revente_interested(request, revente_id):
|
||||||
revente = get_object_or_404(SpectacleRevente, id=revente_id)
|
revente = get_object_or_404(SpectacleRevente, id=revente_id)
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, _ = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=revente.attribution.spectacle.tirage)
|
user=request.user, tirage=revente.attribution.spectacle.tirage)
|
||||||
if (timezone.now() < revente.date + timedelta(hours=1)) or revente.shotgun:
|
if (timezone.now() < revente.date + timedelta(hours=1)) or revente.shotgun:
|
||||||
return render(request, "bda-wrongtime.html",
|
return render(request, "bda-wrongtime.html",
|
||||||
|
@ -387,7 +388,7 @@ def revente_interested(request, revente_id):
|
||||||
@login_required
|
@login_required
|
||||||
def list_revente(request, tirage_id):
|
def list_revente(request, tirage_id):
|
||||||
tirage = get_object_or_404(Tirage, id=tirage_id)
|
tirage = get_object_or_404(Tirage, id=tirage_id)
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, _ = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=tirage)
|
user=request.user, tirage=tirage)
|
||||||
deja_revente = False
|
deja_revente = False
|
||||||
success = False
|
success = False
|
||||||
|
@ -435,7 +436,7 @@ def list_revente(request, tirage_id):
|
||||||
def buy_revente(request, spectacle_id):
|
def buy_revente(request, spectacle_id):
|
||||||
spectacle = get_object_or_404(Spectacle, id=spectacle_id)
|
spectacle = get_object_or_404(Spectacle, id=spectacle_id)
|
||||||
tirage = spectacle.tirage
|
tirage = spectacle.tirage
|
||||||
participant, created = Participant.objects.get_or_create(
|
participant, _ = Participant.objects.get_or_create(
|
||||||
user=request.user, tirage=tirage)
|
user=request.user, tirage=tirage)
|
||||||
reventes = SpectacleRevente.objects.filter(
|
reventes = SpectacleRevente.objects.filter(
|
||||||
attribution__spectacle=spectacle,
|
attribution__spectacle=spectacle,
|
||||||
|
@ -557,7 +558,7 @@ def send_rappel(request, spectacle_id):
|
||||||
'show': show,
|
'show': show,
|
||||||
'nb_attr': 1
|
'nb_attr': 1
|
||||||
})
|
})
|
||||||
exemple_mail_2place = render_mail('bda-rappel', {
|
exemple_mail_2places = render_mail('bda-rappel', {
|
||||||
'member': request.user,
|
'member': request.user,
|
||||||
'show': show,
|
'show': show,
|
||||||
'nb_attr': 2
|
'nb_attr': 2
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from __future__ import division
|
from datetime import datetime
|
||||||
from __future__ import print_function
|
import base64
|
||||||
from __future__ import unicode_literals
|
import json
|
||||||
|
|
||||||
from custommail.utils import send_custom_mail, render_mail
|
from custommail.utils import render_mail
|
||||||
|
from captcha.fields import ReCaptchaField
|
||||||
|
|
||||||
from django.shortcuts import render, get_object_or_404, redirect
|
from django.shortcuts import render, get_object_or_404, redirect
|
||||||
|
from django.core import mail
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms.models import inlineformset_factory, BaseInlineFormSet
|
from django.forms.models import inlineformset_factory, BaseInlineFormSet
|
||||||
|
@ -14,7 +16,6 @@ from django.contrib.auth.models import User
|
||||||
from django.views.generic import ListView
|
from django.views.generic import ListView
|
||||||
from django.utils.decorators import method_decorator
|
from django.utils.decorators import method_decorator
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
from django.template import loader
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
from django.db.models import Min
|
from django.db.models import Min
|
||||||
|
@ -26,12 +27,6 @@ from gestioncof.petits_cours_models import PetitCoursDemande, \
|
||||||
from gestioncof.decorators import buro_required
|
from gestioncof.decorators import buro_required
|
||||||
from gestioncof.shared import lock_table, unlock_tables
|
from gestioncof.shared import lock_table, unlock_tables
|
||||||
|
|
||||||
from captcha.fields import ReCaptchaField
|
|
||||||
|
|
||||||
from datetime import datetime
|
|
||||||
import base64
|
|
||||||
import json
|
|
||||||
|
|
||||||
|
|
||||||
class DemandeListView(ListView):
|
class DemandeListView(ListView):
|
||||||
model = PetitCoursDemande
|
model = PetitCoursDemande
|
||||||
|
@ -286,11 +281,11 @@ def _traitement_post(request, demande):
|
||||||
replyto = settings.MAIL_DATA['petits_cours']['REPLYTO']
|
replyto = settings.MAIL_DATA['petits_cours']['REPLYTO']
|
||||||
mails_to_send = []
|
mails_to_send = []
|
||||||
for (user, msg) in proposed_mails:
|
for (user, msg) in proposed_mails:
|
||||||
msg = EmailMessage("Petits cours ENS par le COF", msg,
|
msg = mail.EmailMessage("Petits cours ENS par le COF", msg,
|
||||||
frommail, [user.email],
|
frommail, [user.email],
|
||||||
[bccaddress], headers={'Reply-To': replyto})
|
[bccaddress], headers={'Reply-To': replyto})
|
||||||
mails_to_send.append(msg)
|
mails_to_send.append(msg)
|
||||||
mails_to_send.append(EmailMessage("Cours particuliers ENS", mainmail,
|
mails_to_send.append(mail.EmailMessage("Cours particuliers ENS", mainmail,
|
||||||
frommail, [demande.email],
|
frommail, [demande.email],
|
||||||
[bccaddress],
|
[bccaddress],
|
||||||
headers={'Reply-To': replyto}))
|
headers={'Reply-To': replyto}))
|
||||||
|
|
|
@ -9,10 +9,7 @@ from django.conf import settings
|
||||||
from django_cas_ng.backends import CASBackend
|
from django_cas_ng.backends import CASBackend
|
||||||
from django_cas_ng.utils import get_cas_client
|
from django_cas_ng.utils import get_cas_client
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import User as DjangoUser
|
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
from django.core.mail import send_mail
|
|
||||||
from django.template import Template, Context
|
|
||||||
|
|
||||||
from gestioncof.models import CofProfile
|
from gestioncof.models import CofProfile
|
||||||
|
|
||||||
|
|
|
@ -465,15 +465,15 @@ def registration(request):
|
||||||
current_registration.paid = \
|
current_registration.paid = \
|
||||||
(form.cleaned_data['status'] == 'paid')
|
(form.cleaned_data['status'] == 'paid')
|
||||||
current_registration.save()
|
current_registration.save()
|
||||||
if form.event.title == "Mega 15" and created_reg:
|
# if form.event.title == "Mega 15" and created_reg:
|
||||||
field = EventCommentField.objects.get(
|
# field = EventCommentField.objects.get(
|
||||||
event=form.event, name="Commentaires")
|
# event=form.event, name="Commentaires")
|
||||||
try:
|
# try:
|
||||||
comments = EventCommentValue.objects.get(
|
# comments = EventCommentValue.objects.get(
|
||||||
commentfield=field,
|
# commentfield=field,
|
||||||
registration=current_registration).content
|
# registration=current_registration).content
|
||||||
except EventCommentValue.DoesNotExist:
|
# except EventCommentValue.DoesNotExist:
|
||||||
comments = field.default
|
# comments = field.default
|
||||||
# FIXME : il faut faire quelque chose de propre ici,
|
# FIXME : il faut faire quelque chose de propre ici,
|
||||||
# par exemple écrire un mail générique pour
|
# par exemple écrire un mail générique pour
|
||||||
# l'inscription aux événements et/ou donner la
|
# l'inscription aux événements et/ou donner la
|
||||||
|
|
Loading…
Reference in a new issue