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