diff --git a/PyRIGS/settings.py b/PyRIGS/settings.py index ba485a9e..82b94bb4 100644 --- a/PyRIGS/settings.py +++ b/PyRIGS/settings.py @@ -253,7 +253,7 @@ TEMPLATES = [ "django.template.context_processors.request", "django.contrib.messages.context_processors.messages", ], - 'debug': DEBUG or CI + 'debug': DEBUG }, }, ] diff --git a/RIGS/rigboard.py b/RIGS/rigboard.py index 45da678f..99c913ad 100644 --- a/RIGS/rigboard.py +++ b/RIGS/rigboard.py @@ -11,7 +11,7 @@ import simplejson from PyPDF2 import PdfFileMerger, PdfFileReader from django.conf import settings from django.contrib import messages -from django.contrib.staticfiles.storage import staticfiles_storage +from django.contrib.staticfiles import finders from django.core import signing from django.core.exceptions import SuspiciousOperation from django.core.mail import EmailMultiAlternatives @@ -274,6 +274,7 @@ class EventArchive(generic.ListView): class EventAuthorise(generic.UpdateView): template_name = 'eventauthorisation_form.html' success_template = 'eventauthorisation_success.html' + preview = False def form_valid(self, form): self.object = form.save() @@ -301,6 +302,7 @@ class EventAuthorise(generic.UpdateView): context['page_title'] = "{}: {}".format(self.event.display_id, self.event.name) if self.event.dry_hire: context['page_title'] += ' Dry Hire' + context['preview'] = self.preview return context def get(self, request, *args, **kwargs): @@ -387,7 +389,7 @@ class EventAuthorisationRequest(generic.FormView, generic.detail.SingleObjectMix to=[email], reply_to=[self.request.user.email], ) - css = staticfiles_storage.path('css/email.css') + css = finders.find('css/email.css') html = premailer.Premailer(get_template("eventauthorisation_client_request.html").render(context), external_styles=css).transform() msg.attach_alternative(html, 'text/html') @@ -402,8 +404,7 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView): model = models.Event def render_to_response(self, context, **response_kwargs): - from django.contrib.staticfiles.storage import staticfiles_storage - css = staticfiles_storage.path('css/email.css') + css = finders.find('css/email.css') response = super(EventAuthoriseRequestEmailPreview, self).render_to_response(context, **response_kwargs) assert isinstance(response, HttpResponse) response.content = premailer.Premailer(response.rendered_content, external_styles=css).transform() @@ -417,4 +418,5 @@ class EventAuthoriseRequestEmailPreview(generic.DetailView): 'sent_by': self.request.user.pk, }) context['to_name'] = self.request.GET.get('to_name', None) + context['target'] = 'event_authorise_form_preview' return context diff --git a/RIGS/signals.py b/RIGS/signals.py index e01deef6..e1fc37b0 100644 --- a/RIGS/signals.py +++ b/RIGS/signals.py @@ -6,7 +6,7 @@ from io import BytesIO from PyPDF2 import PdfFileReader, PdfFileMerger from django.conf import settings -from django.contrib.staticfiles.storage import staticfiles_storage +from django.contrib.staticfiles import finders from django.core.cache import cache from django.core.mail import EmailMessage, EmailMultiAlternatives from django.db.models.signals import post_save @@ -63,7 +63,7 @@ def send_eventauthorisation_success_email(instance): reply_to=[settings.AUTHORISATION_NOTIFICATION_ADDRESS], ) - css = staticfiles_storage.path('css/email.css') + css = finders.find('css/email.css') html = Premailer(get_template("eventauthorisation_client_success.html").render(context), external_styles=css).transform() client_email.attach_alternative(html, 'text/html') @@ -121,7 +121,7 @@ def send_admin_awaiting_approval_email(user, request, **kwargs): to=[admin.email], reply_to=[user.email], ) - css = staticfiles_storage.path('css/email.css') + css = finders.find('css/email.css') html = Premailer(get_template("admin_awaiting_approval.html").render(context), external_styles=css).transform() email.attach_alternative(html, 'text/html') diff --git a/RIGS/templates/event_detail.html b/RIGS/templates/event_detail.html index 282f7e53..d9182e3d 100644 --- a/RIGS/templates/event_detail.html +++ b/RIGS/templates/event_detail.html @@ -7,7 +7,7 @@ {% if not request.is_ajax %} {% if perms.RIGS.view_event %}
Hi {{ to_name|default:"there" }},
-{{ request.user.get_full_name }} has requested that you authorise N{{ object.pk|stringformat:"05d" }} +
{{ request.user.get_full_name }} has requested that you authorise {{ object.display_id }} | {{ object.name }}{% if not to_name %} on behalf of {{ object.person.name }}{% endif %}.
@@ -23,7 +23,7 @@
| - + Complete Authorisation Form | diff --git a/RIGS/templates/eventauthorisation_form.html b/RIGS/templates/eventauthorisation_form.html index 155cdeb7..771ddeaa 100644 --- a/RIGS/templates/eventauthorisation_form.html +++ b/RIGS/templates/eventauthorisation_form.html @@ -1,9 +1,6 @@ {% extends 'eventauthorisation.html' %} {% load widget_tweaks %} -{% block js %} -{% endblock %} - {% block authorisation %}