Commit 5610db4c authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'fix/535-hide-unavailable-docs' into 'master'

Hide association documents when unavailable

Closes #535

See merge request !625
parents 31e26d23 80fc906b
{% extends "documents/associationdocument.html" %}
{% block icons %}
{% for document in documents %}
{% if documents.annual %}
<li>
<a target="_blank"
{% if forloop.first %}
href="{% url 'documents:association-document' 'annual-report' year %}"
class="overlay-icon-link"
{% else %}
></a>
</li>
{% endif %}
{% if documents.financial %}
<li>
<a target="_blank"
href="{% url 'documents:association-document' 'financial-report' year %}"
class="overlay-icon-euro"
{% endif %}
></a>
</li>
{% endfor %}
{% endblock %}
\ No newline at end of file
{% endif %}
{% endblock %}
......@@ -17,18 +17,21 @@ def index(request):
years = {x: None for x in range(1990, lectureyear + 1)}
for obj in AssociationDocumentsYear.objects.all():
years[obj.year] = {'policy': [obj.policy_document],
'report': [obj.annual_report, obj.financial_report],
}
years[obj.year] = {'policy': obj.policy_document,
'report': {'annual': obj.annual_report,
'financial': obj.financial_report}}
for year_docs in years.values():
if year_docs is not None:
for docs in year_docs.values():
# Duplicate list to prevent disrupting iteration by removing
for doc in list(docs):
try:
doc.file
except ValueError:
docs.remove(doc)
try:
year_docs['policy'].file
except ValueError:
year_docs['policy'] = None
for report in year_docs['report']:
try:
year_docs['report'][report].file
except ValueError:
year_docs['report'][report] = None
meeting_years = {x: [] for x in range(1990, lectureyear + 1)}
for obj in GeneralMeeting.objects.all():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment