diff --git a/models/database.py b/models/database.py index a60440ccfc83cb894baf2134a11ff0071f7ae3cb..28ef73aaece4bacb9b04dd4c6c18964b30666e22 100644 --- a/models/database.py +++ b/models/database.py @@ -281,10 +281,11 @@ class Protocol(DatabaseModel): if not todo.is_done() ] - def has_compiled_document(self): + def has_compiled_document(self, private=None): candidates = [ document for document in self.documents if document.is_compiled + and (private is None or document.is_private == private) ] return len(candidates) > 0 diff --git a/templates/index.html b/templates/index.html index 03c0d2d9dd83bbea58ef71f476a05460d1f7d65b..7db27c9736dc63a60079d31c292a4b333d7b3f20 100644 --- a/templates/index.html +++ b/templates/index.html @@ -32,7 +32,7 @@ {% if protocol.protocoltype.has_modify_right(current_user()) %} <a class="btn btn-default" href="{{url_for("update_protocol", protocol_id=protocol.id)}}">Protokoll editieren</a> {% endif %} - {% if protocol.has_compiled_document() %} + {% if protocol.has_compiled_document(private=show_private) %} <a class="btn btn-success" href="{{url_for("download_document", document_id=protocol.get_compiled_document(private=show_private).id)}}">Download</a> {% endif %} </div>