Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
80fc906b
Commit
80fc906b
authored
Nov 29, 2017
by
Tom van Bussel
Browse files
Hide association documents when unavailable
parent
99db59f1
Changes
2
Hide whitespace changes
Inline
Side-by-side
website/documents/templates/documents/report.html
View file @
80fc906b
{% extends "documents/associationdocument.html" %}
{% block icons %}
{% f
or
document
in documents
%}
{%
i
f document
s.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 %}
website/documents/views.py
View file @
80fc906b
...
...
@@ -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
():
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment