diff --git a/config/urls.py b/config/urls.py index c4185016f0..ac6cf68ee1 100644 --- a/config/urls.py +++ b/config/urls.py @@ -36,6 +36,7 @@ import search.urls import sso.urls import sso_profile.urls +from core.views import WagtailServeDocument urlpatterns = [] @@ -85,6 +86,11 @@ path( 'documents/', decorator_include(nocache_page, wagtaildocs_urls) ), # NB: doesn't skip GA as we may analytics on this + path( + 'document//', + nocache_page(WagtailServeDocument.as_view()), + name='wagtail_serve_documents', + ), path('great-cms-sso/', include(sso.urls)), path('search/', include(search.urls, namespace='search')), path('activity-stream/', decorator_include(nocache_page, activitystream.urls, namespace='activitystream')), diff --git a/core/views.py b/core/views.py index d6bbd7a643..d9886e2246 100644 --- a/core/views.py +++ b/core/views.py @@ -9,7 +9,13 @@ from django.conf import settings from django.contrib.sitemaps import Sitemap as DjangoSitemap from django.core.files.storage import default_storage -from django.http import Http404, HttpResponse, HttpResponseRedirect, JsonResponse +from django.http import ( + Http404, + HttpResponse, + HttpResponseBadRequest, + HttpResponseRedirect, + JsonResponse, +) from django.shortcuts import get_object_or_404, redirect from django.template.loader import render_to_string from django.template.response import TemplateResponse @@ -27,6 +33,7 @@ from rest_framework.response import Response from storages.backends.s3boto3 import S3Boto3Storage from wagtail.contrib.sitemaps import Sitemap as WagtailSitemap +from wagtail.documents.models import Document from wagtail.images import get_image_model from wagtail.images.views import chooser from wagtail.images.views.chooser import ( @@ -1018,3 +1025,14 @@ def get_context_data(self, **kwargs): ukea_events=ukea_events, market_guide=market_guide, ) + + +class WagtailServeDocument(View): + + def get(self, request, document_title): + try: + document = Document.objects.get(title=document_title) + except Document.DoesNotExist: + return HttpResponseBadRequest(()) + else: + return HttpResponseRedirect(redirect_to=document.file.url) diff --git a/find_a_buyer/views.py b/find_a_buyer/views.py index ecaba4a40c..fd3ccbb798 100644 --- a/find_a_buyer/views.py +++ b/find_a_buyer/views.py @@ -51,7 +51,6 @@ def send_update_error_to_sentry(sso_user, api_response): def done(self, *args, **kwargs): data = self.serialize_form_data() - data['is_verification_letter_sent'] = True # Mixin only used in SendVerificationLetterView response = api_client.company.profile_update(sso_session_id=self.request.user.session_id, data=data) try: response.raise_for_status() diff --git a/international/templates/international/contact.html b/international/templates/international/contact.html index 6b5576c105..2940d32099 100644 --- a/international/templates/international/contact.html +++ b/international/templates/international/contact.html @@ -23,91 +23,86 @@ {% endblock %} {% block content %}
- {% if request.GET.success %} -
-
{% include './includes/contact_success.html' with back_url=back_url %}
+ {% if form.errors and not form.non_field_errors %} + - {% else %} - {% if form.errors and not form.non_field_errors %} -