mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Add changes suggested by DT
This commit is contained in:
@@ -149,7 +149,7 @@ class BaseClientEventAuthorisationForm(forms.ModelForm):
|
|||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
if self.cleaned_data.get('amount') != self.instance.event.total:
|
if self.cleaned_data.get('amount') != self.instance.event.total:
|
||||||
self.add_error('amount', 'The amount authorised must equal the total for the event.')
|
self.add_error('amount', 'The amount authorised must equal the total for the event (inc VAT).')
|
||||||
return super(BaseClientEventAuthorisationForm, self).clean()
|
return super(BaseClientEventAuthorisationForm, self).clean()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ class EventPrint(generic.View):
|
|||||||
|
|
||||||
merger = PdfFileMerger()
|
merger = PdfFileMerger()
|
||||||
|
|
||||||
context = RequestContext(request, { # this should be outside the loop, but bug in 1.8.2 prevents this
|
context = RequestContext(request, {
|
||||||
'object': object,
|
'object': object,
|
||||||
'fonts': {
|
'fonts': {
|
||||||
'opensans': {
|
'opensans': {
|
||||||
@@ -227,7 +227,8 @@ class EventAuthorise(generic.UpdateView):
|
|||||||
|
|
||||||
self.template_name = self.success_template
|
self.template_name = self.success_template
|
||||||
messages.add_message(self.request, messages.SUCCESS,
|
messages.add_message(self.request, messages.SUCCESS,
|
||||||
'Success! Your event has been authorised. You will also receive email confirmation.')
|
'Success! Your event has been authorised. ' +
|
||||||
|
'You will also receive email confirmation to %s.' % (self.object.email))
|
||||||
return self.render_to_response(self.get_context_data())
|
return self.render_to_response(self.get_context_data())
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@@ -259,10 +260,11 @@ class EventAuthorise(generic.UpdateView):
|
|||||||
if self.get_object() is not None and self.get_object().pk is not None:
|
if self.get_object() is not None and self.get_object().pk is not None:
|
||||||
if self.event.authorised:
|
if self.event.authorised:
|
||||||
messages.add_message(self.request, messages.WARNING,
|
messages.add_message(self.request, messages.WARNING,
|
||||||
"This event has already been authorised. Please confirm you wish to reauthorise")
|
"This event has already been authorised. "
|
||||||
|
"Reauthorising is not necessary at this time.")
|
||||||
else:
|
else:
|
||||||
messages.add_message(self.request, messages.WARNING,
|
messages.add_message(self.request, messages.WARNING,
|
||||||
"This event has already been authorised, but the amount has changed." +
|
"This event has already been authorised, but the amount has changed. " +
|
||||||
"Please check the amount and reauthorise.")
|
"Please check the amount and reauthorise.")
|
||||||
return super(EventAuthorise, self).get(request, *args, **kwargs)
|
return super(EventAuthorise, self).get(request, *args, **kwargs)
|
||||||
|
|
||||||
@@ -280,7 +282,7 @@ class EventAuthorise(generic.UpdateView):
|
|||||||
request.email = data['email']
|
request.email = data['email']
|
||||||
except (signing.BadSignature, AssertionError, KeyError):
|
except (signing.BadSignature, AssertionError, KeyError):
|
||||||
raise SuspiciousOperation(
|
raise SuspiciousOperation(
|
||||||
"The security integrity of that URL is invalid. Please contact your event MIC to obtain a new URL")
|
"This URL is invalid. Please ask your TEC contact for a new URL")
|
||||||
return super(EventAuthorise, self).dispatch(request, *args, **kwargs)
|
return super(EventAuthorise, self).dispatch(request, *args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@@ -320,6 +322,7 @@ class EventAuthorisationRequest(generic.FormView, generic.detail.SingleObjectMix
|
|||||||
"N%05d | %s - Event Authorisation Request" % (self.object.pk, self.object.name),
|
"N%05d | %s - Event Authorisation Request" % (self.object.pk, self.object.name),
|
||||||
get_template("RIGS/eventauthorisation_client_request.txt").render(context),
|
get_template("RIGS/eventauthorisation_client_request.txt").render(context),
|
||||||
to=[email],
|
to=[email],
|
||||||
|
reply_to=[settings.AUTHORISATION_NOTIFICATION_ADDRESS],
|
||||||
)
|
)
|
||||||
|
|
||||||
msg.send()
|
msg.send()
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ def send_eventauthorisation_success_email(instance):
|
|||||||
client_email = EmailMessage(
|
client_email = EmailMessage(
|
||||||
subject,
|
subject,
|
||||||
get_template("RIGS/eventauthorisation_client_success.txt").render(context),
|
get_template("RIGS/eventauthorisation_client_success.txt").render(context),
|
||||||
to=[instance.email]
|
to=[instance.email],
|
||||||
|
reply_to=[settings.AUTHORISATION_NOTIFICATION_ADDRESS],
|
||||||
)
|
)
|
||||||
|
|
||||||
escapedEventName = re.sub('[^a-zA-Z0-9 \n\.]', '', instance.event.name)
|
escapedEventName = re.sub('[^a-zA-Z0-9 \n\.]', '', instance.event.name)
|
||||||
|
|||||||
@@ -5,17 +5,23 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-sm-offset-1 col-sm-10">
|
<div class="col-sm-12">
|
||||||
|
<div class="alert alert-warning">
|
||||||
|
<h1>Send authorisation request email.</h1>
|
||||||
|
<p>Pressing send will email the address provided. Please triple check everything before continuing.</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-12 col-md-10 col-md-offset-1">
|
||||||
<form action="{{ form.action|default:request.path }}" method="post" class="form-horizontal">{% csrf_token %}
|
<form action="{{ form.action|default:request.path }}" method="post" class="form-horizontal">{% csrf_token %}
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% include 'form_errors.html' %}
|
{% include 'form_errors.html' %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="col-sm-2 control-label"
|
<label class="col-sm-3 control-label"
|
||||||
for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
|
for="{{ form.email.id_for_label }}">{{ form.email.label }}</label>
|
||||||
|
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-9">
|
||||||
{% render_field form.email type="email" class+="form-control" %}
|
{% render_field form.email type="email" class+="form-control" %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user