Merge branch 'master' into categories
This commit is contained in:
commit
f26c4496e1
1 changed files with 52 additions and 65 deletions
|
@ -45,7 +45,7 @@ def calendar(request, pYear, pMonth):
|
||||||
lPreviousMonth = lMonth - 1
|
lPreviousMonth = lMonth - 1
|
||||||
if lPreviousMonth == 0:
|
if lPreviousMonth == 0:
|
||||||
lPreviousMonth = 12
|
lPreviousMonth = 12
|
||||||
lPreviousYear - 1
|
lPreviousYear -= 1
|
||||||
lNextYear = lYear
|
lNextYear = lYear
|
||||||
lNextMonth = lMonth + 1
|
lNextMonth = lMonth + 1
|
||||||
if lNextMonth == 13:
|
if lNextMonth == 13:
|
||||||
|
@ -105,6 +105,7 @@ def view_eventbis(request, id):
|
||||||
return render(request, 'calendrier/view_event.html', locals())
|
return render(request, 'calendrier/view_event.html', locals())
|
||||||
|
|
||||||
|
|
||||||
|
# XXX: Horrible nasty code duplication. Go to hell RikM
|
||||||
@chef_required
|
@chef_required
|
||||||
def resend(request, id):
|
def resend(request, id):
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
@ -113,7 +114,6 @@ def resend(request, id):
|
||||||
ev = get_object_or_404(Event, id=id)
|
ev = get_object_or_404(Event, id=id)
|
||||||
users = ErnestoUser.objects.filter(is_ernesto=True)
|
users = ErnestoUser.objects.filter(is_ernesto=True)
|
||||||
message = form.cleaned_data["message"]
|
message = form.cleaned_data["message"]
|
||||||
try:
|
|
||||||
for user in users:
|
for user in users:
|
||||||
if user.mails:
|
if user.mails:
|
||||||
Subject = "[Pouet-Pouet] %s, le %s" % (
|
Subject = "[Pouet-Pouet] %s, le %s" % (
|
||||||
|
@ -131,24 +131,18 @@ def resend(request, id):
|
||||||
'Pour répondre non, allez sur %s%s\n'
|
'Pour répondre non, allez sur %s%s\n'
|
||||||
'Pour répondre peut-être, allez sur %s%s\n') \
|
'Pour répondre peut-être, allez sur %s%s\n') \
|
||||||
% (domain,
|
% (domain,
|
||||||
reverse_lazy('view-event', args=[obj.id]),
|
reverse_lazy('view-event', args=[ev.id]),
|
||||||
domain,
|
domain,
|
||||||
reverse_lazy(
|
reverse_lazy('calendrier.reponse_event', args=[user.slug, ev.slug, "oui"]),
|
||||||
'calendrier.reponse_event',
|
|
||||||
args=[user.slug, obj.slug, "oui"]),
|
|
||||||
domain,
|
domain,
|
||||||
reverse_lazy(
|
reverse_lazy('calendrier.reponse_event', args=[user.slug, ev.slug, "non"]),
|
||||||
'calendrier.reponse_event',
|
|
||||||
args=[user.slug, obj.slug, "non"]),
|
|
||||||
domain,
|
domain,
|
||||||
reverse_lazy(
|
reverse_lazy('calendrier.reponse_event', args=[user.slug, ev.slug, "pe"]))
|
||||||
'calendrier.reponse_event',
|
try:
|
||||||
args=[user.slug, obj.slug, "pe"]))
|
|
||||||
send_mail(Subject, text, sender, receivers)
|
send_mail(Subject, text, sender, receivers)
|
||||||
return redirect("calendrier.views.view_eventbis", id)
|
|
||||||
except:
|
except:
|
||||||
erreur = "Une erreur est survenue, le mail n'a pas pu être " \
|
erreur = "Une erreur est survenue, le mail n'a pas pu être envoyé."
|
||||||
+ "envoyé."
|
return redirect("calendrier.views.view_eventbis", id)
|
||||||
else:
|
else:
|
||||||
form = SendMail()
|
form = SendMail()
|
||||||
return render(request, "calendrier/resend.html", locals())
|
return render(request, "calendrier/resend.html", locals())
|
||||||
|
@ -194,7 +188,6 @@ def create_event(request):
|
||||||
users = ErnestoUser.objects.filter(is_ernesto=True)
|
users = ErnestoUser.objects.filter(is_ernesto=True)
|
||||||
for user in users:
|
for user in users:
|
||||||
if user.mails:
|
if user.mails:
|
||||||
try:
|
|
||||||
Subject = "[Pouet-Pouet] %s, le %s" % (nom, date)
|
Subject = "[Pouet-Pouet] %s, le %s" % (nom, date)
|
||||||
sender = 'fanfare@ens.fr'
|
sender = 'fanfare@ens.fr'
|
||||||
receivers = [user.user.email]
|
receivers = [user.user.email]
|
||||||
|
@ -211,21 +204,15 @@ def create_event(request):
|
||||||
% (domain,
|
% (domain,
|
||||||
reverse('view-event', args=[obj.id]),
|
reverse('view-event', args=[obj.id]),
|
||||||
domain,
|
domain,
|
||||||
reverse(
|
reverse('calendrier.reponse_event', args=[user.slug, obj.slug, "oui"]),
|
||||||
'calendrier.reponse_event',
|
|
||||||
args=[user.slug, obj.slug, "oui"]),
|
|
||||||
domain,
|
domain,
|
||||||
reverse(
|
reverse('calendrier.reponse_event', args=[user.slug, obj.slug, "non"]),
|
||||||
'calendrier.reponse_event',
|
|
||||||
args=[user.slug, obj.slug, "non"]),
|
|
||||||
domain,
|
domain,
|
||||||
reverse(
|
reverse('calendrier.reponse_event', args=[user.slug, obj.slug, "pe"]))
|
||||||
'calendrier.reponse_event',
|
try:
|
||||||
args=[user.slug, obj.slug, "pe"]))
|
|
||||||
send_mail(Subject, text, sender, receivers)
|
send_mail(Subject, text, sender, receivers)
|
||||||
except:
|
except:
|
||||||
erreur = "Une erreur est survenue, le mail n'a " \
|
erreur = "Une erreur est survenue, le mail n'a pas pu être envoyé."
|
||||||
+ "pas pu être envoyé."
|
|
||||||
else:
|
else:
|
||||||
form = EventForm()
|
form = EventForm()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue