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