From 5741263f13aa465a722e548d4977ab93cda65658 Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Wed, 24 Jan 2018 11:32:14 +0000
Subject: [PATCH] Update the error message to be more helpful

---
 opentech/apply/funds/models.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/opentech/apply/funds/models.py b/opentech/apply/funds/models.py
index e665586d4..9f575ea6a 100644
--- a/opentech/apply/funds/models.py
+++ b/opentech/apply/funds/models.py
@@ -4,6 +4,7 @@ from django.core.exceptions import ValidationError
 from django.db import models
 from django.db.models import Q
 from django.http import Http404
+from django.urls import reverse
 from django.utils.text import mark_safe
 
 from modelcluster.fields import ParentalKey
@@ -30,6 +31,10 @@ WORKFLOW_CLASS = {
 }
 
 
+def admin_url(page):
+    return reverse('wagtailadmin_pages:edit', args=(page.id,))
+
+
 class FundType(AbstractStreamForm):
     parent_page_types = ['apply_home.ApplyHomePage']
     subpage_types = ['funds.Round']
@@ -157,7 +162,10 @@ class Round(AbstractStreamForm):
 
         if conflicting_rounds.exists():
             error_message = mark_safe('Overlaps with the following rounds:<br> {}'.format(
-                '<br>'.join([f'{round.start_date} - {round.end_date}' for round in conflicting_rounds])
+                '<br>'.join([
+                    f'<a href="{admin_url(round)}">{round.title}</a>: {round.start_date} - {round.end_date}'
+                    for round in conflicting_rounds]
+                )
             ))
             error = {
                 'start_date': error_message,
-- 
GitLab