Skip to content

Commit

Permalink
[#367] Add common error for 360
Browse files Browse the repository at this point in the history
  • Loading branch information
kindly committed May 27, 2016
1 parent 650100a commit 47f7778
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
61 changes: 61 additions & 0 deletions cove/templates/common_errors_360.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{% extends 'base_360.html' %}
{% load i18n %}
{% block content %}

<div>
<h2>{% trans "Common Errors" %}</h2>
<a name="uri"></a>
<h3>{% trans "Invalid 'uri' found" %}</h3>
<p>{% blocktrans %}This message means you have a problem, usually with a website address in your data.<br />Common mistakes include:{% endblocktrans %}</p>
<ul>
<li>{% blocktrans %}Not starting the address with 'http://' e.g. example.com is not a 'uri' but http://example.com is.{% endblocktrans %}</li>
<li>{% blocktrans %}Having extra spaces at the start or end of the address - these should be removed{% endblocktrans %}</li>
<li>{% blocktrans %}Putting more than one address in the same field e.g. "http://example.com and http:example2.com" is not a 'uri'{% endblocktrans %}</li>
</ul>

<a name="date-time"></a>
<h3>{% trans "Date is not in datetime format" %}</h3>
<p>{% blocktrans %}A datetime format is a very specific form of a date and time that is specified by the 360Giving Standard.{% endblocktrans %}</p>
<p>{% blocktrans %}A datetime should be in the form of YYYY-MM-DDThh:mm:ss±hh:mm where:{% endblocktrans %}</p>
<ul>
<li>{% blocktrans %}YYYY represent a year e.g. 2016{% endblocktrans %}</li>
<li>{% blocktrans %}MM represents a 2 digit month of the year e.g. 01 for January{% endblocktrans %}</li>
<li>{% blocktrans %}DD represents a 2 digit day of the month e.g. 01 for the 1st{% endblocktrans %}</li>
<li>{% blocktrans %}T is simply the letter 'T'{% endblocktrans %}</li>
<li>{% blocktrans %}hh is a 2 digit representation of an hour e.g. 01 for 1AM, 13 for 1PM{% endblocktrans %}</li>
<li>{% blocktrans %}mm is a 2 digit representation of minutes in an hour e.g. 05 for 5 past{% endblocktrans %}</li>
<li>{% blocktrans %}ss is a 2 digit representation of seconds{% endblocktrans %}</li>
<li>{% blocktrans %}±hh:mm is a timezone offset from UTC. For must UK data producers this can simply be replaced with a 'Z'{% endblocktrans %}</li>
</ul>
<p>{% blocktrans %}Example: 2016-05-15T12:00:00Z is 12 noon on the 15th May 2016 in UTC time{% endblocktrans %}</p>

<a name="required"></a>
<h3>{% trans "(something) is missing but is required" %}</h3>
<p>{% blocktrans %}Many fields are required in the 360Giving data standard in order for others to make sense of the data supplied. If any of the following fields are missing the data is seen as invalid against the schema.{% endblocktrans %}</p>
<table class="table">
<thead>
<tr>
<th>{% trans "Field" %}</th><th>{% trans "JSON value" %}</th><th>{% trans "Notes" %}</th><th>{% trans "Documentation" %}</th>
</tr>
</thead>
<tbody>
<tr>
<td>Identifier</td><td>id</td><td>{% blocktrans %}Every grant needs a unique identifier so we can tel them apart{% endblocktrans %}</td><td><a href="http://www.threesixtygiving.org/standard/identifiers/#toc-grant-identifier">{% trans "Grant Indentifiers" %}</a></td>
</tr>
</tbody>
</table>
<!--<p>{% blocktrans %}Example{% endblocktrans %}</p>-->

<p>&nbsp;</p>


</div>

{% block howToUse %}
{% endblock %}
{% block deletingData %}
{% endblock %}
{% block whyConvert %}
{% endblock %}

{% endblock %}
1 change: 1 addition & 0 deletions cove/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def cause500(request):
urlpatterns = [
url(r'^$', 'cove.input.views.input', name='index'),
url(r'^data/(.+)$', 'cove.views.explore', name='explore'),
url(r'^common_errors', 'cove.views.common_errors', name='common_errors'),
url(r'^terms', TemplateView.as_view(template_name='terms.html'), name='terms'),
url(r'^stats', 'cove.views.stats', name='stats'),
url(r'^test/500', cause500),
Expand Down
7 changes: 7 additions & 0 deletions cove/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from jsonschema.validators import Draft4Validator as validator
from django.db.models.aggregates import Count
from django.utils import timezone
from django.http import Http404
from datetime import timedelta
import cove.lib.common as common
import cove.lib.ocds as ocds
Expand Down Expand Up @@ -178,3 +179,9 @@ def stats(request):
{x['form_name']: x['id__count'] for x in by_form.filter(created__gt=timezone.now() - timedelta(days=num_days))}
) for num_days in [1, 7, 30]],
})


def common_errors(request):
if request.current_app == 'cove-360':
return render(request, 'common_errors_360.html')
raise Http404('Common error page does not exist')

0 comments on commit 47f7778

Please sign in to comment.