Skip to content
Snippets Groups Projects
Commit 5741263f authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Update the error message to be more helpful

parent 1a145087
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment