Skip to content

Commit 3cee051

Browse files
authored
Merge pull request #451 from WikipediaLibrary/kgraessle/add-warning-banners-temporarily
Create banners to indicate wrong data on Wikilink
2 parents c92ed98 + 9665bb8 commit 3cee051

File tree

5 files changed

+45
-1
lines changed

5 files changed

+45
-1
lines changed

extlinks/organisations/templates/organisations/organisation_detail.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,15 @@
1616
</ul>
1717
</nav>
1818
<nav id="content" class="charts-body">
19+
{% if messages %}
20+
<div class="messages">
21+
{% for message in messages %}
22+
<h3>
23+
{{ message }}
24+
</h3>
25+
{% endfor %}
26+
</div>
27+
{% endif %}
1928
<div class="row">
2029
<div class="col-6">
2130
<h1>{{ object }}</h1>

extlinks/organisations/views.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import re
44

5+
from django.contrib import messages
56
from django.db.models import Count, Sum, Q, Prefetch, CharField
67
from django.db.models.functions import Cast
78
from django.http import JsonResponse
@@ -47,6 +48,12 @@ def get_queryset(self, **kwargs):
4748
# This is almost, but not exactly, the same as the program view.
4849
# As such, most context gathering is split out to a helper.
4950
def get_context_data(self, **kwargs):
51+
messages.warning(
52+
self.request,
53+
"We have modified where Wikilink obtains its data from. Since some of this work is "
54+
"still in flight, the data shown in Wikilink is currently erroneous. ",
55+
fail_silently=True,
56+
)
5057
context = super(OrganisationDetailView, self).get_context_data(**kwargs)
5158
form = self.form_class(self.request.GET)
5259
context["form"] = form
@@ -76,7 +83,9 @@ def get_context_data(self, **kwargs):
7683
context["collections"][collection_key] = {}
7784
context["collections"][collection_key]["object"] = collection
7885
context["collections"][collection_key]["collection_id"] = collection.pk
79-
context["collections"][collection_key]["urls"] = collection.get_url_patterns()
86+
context["collections"][collection_key][
87+
"urls"
88+
] = collection.get_url_patterns()
8089

8190
context["collections"][collection_key] = (
8291
self._build_collection_context_dictionary(

extlinks/programs/templates/programs/program_detail.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313
</ul>
1414
</nav>
1515
<nav id="content" class="charts-body">
16+
{% if messages %}
17+
<div class="messages">
18+
{% for message in messages %}
19+
<h3>
20+
{{ message }}
21+
</h3>
22+
{% endfor %}
23+
</div>
24+
{% endif %}
1625
<div class="row">
1726
<div class="col-6">
1827
<h1>{{ object }}</h1>

extlinks/programs/views.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from datetime import date, timedelta
22
import json
33

4+
from django.contrib import messages
45
from django.db.models import Sum, Count, Q
56
from django.http import JsonResponse
67
from django.views.generic import ListView, DetailView
@@ -42,6 +43,12 @@ def get_queryset(self, **kwargs):
4243

4344
def get_context_data(self, **kwargs):
4445
context = super(ProgramDetailView, self).get_context_data(**kwargs)
46+
messages.warning(
47+
self.request,
48+
"We have modified where Wikilink obtains its data from. Since some of this work is "
49+
"still in flight, the data shown in Wikilink is currently erroneous. ",
50+
fail_silently=True,
51+
)
4552
this_program_organisations = self.object.organisation_set.all()
4653
context["organisations"] = this_program_organisations
4754
context["program_id"] = self.object.pk

static/css/local.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,13 @@ hr {
123123
border-top-color: #9a9a9a;
124124
border-top-width: 4px;
125125
}
126+
127+
.messages{
128+
display: flex;
129+
justify-content: center;
130+
margin: 2rem;
131+
background-color: #fdf2d5;
132+
border-style: solid;
133+
border-width: 0.25em;
134+
border-color: #fbe2a2;
135+
}

0 commit comments

Comments
 (0)