mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 11:27:09 +00:00
fix: hide map on detail pages when no location set
This commit is contained in:
@@ -102,6 +102,10 @@ class OrganisationAnswerSet(AnswerSet):
|
|||||||
#: Answers to :class:`OrganisationQuestion`s
|
#: Answers to :class:`OrganisationQuestion`s
|
||||||
question_answers = models.ManyToManyField(OrganisationQuestionChoice)
|
question_answers = models.ManyToManyField(OrganisationQuestionChoice)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def location_set(self) -> bool:
|
||||||
|
return self.latitude and self.longitude
|
||||||
|
|
||||||
def public_answers(self) -> models.QuerySet:
|
def public_answers(self) -> models.QuerySet:
|
||||||
"""Get answers to questions which are public."""
|
"""Get answers to questions which are public."""
|
||||||
return self.question_answers.filter(question__answer_is_public=True)
|
return self.question_answers.filter(question__answer_is_public=True)
|
||||||
|
|||||||
@@ -188,6 +188,10 @@ class PersonAnswerSet(AnswerSet):
|
|||||||
#: Longitude for displaying location on a map
|
#: Longitude for displaying location on a map
|
||||||
longitude = models.FloatField(blank=True, null=True)
|
longitude = models.FloatField(blank=True, null=True)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def location_set(self) -> bool:
|
||||||
|
return self.latitude and self.longitude
|
||||||
|
|
||||||
def public_answers(self) -> models.QuerySet:
|
def public_answers(self) -> models.QuerySet:
|
||||||
"""Get answers to questions which are public."""
|
"""Get answers to questions which are public."""
|
||||||
return self.question_answers.filter(question__answer_is_public=True)
|
return self.question_answers.filter(question__answer_is_public=True)
|
||||||
|
|||||||
@@ -58,7 +58,10 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
{% if organisation.current_answers.location_set %}
|
||||||
<div id="map" style="height: 800px; width: 100%"></div>
|
<div id="map" style="height: 800px; width: 100%"></div>
|
||||||
|
<hr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
|||||||
@@ -79,9 +79,10 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
{% if person.current_answers.location_set %}
|
||||||
<div id="map" style="height: 800px; width: 100%"></div>
|
<div id="map" style="height: 800px; width: 100%"></div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% include 'people/person/includes/relationships_full.html' %}
|
{% include 'people/person/includes/relationships_full.html' %}
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,9 @@
|
|||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
{% if person.current_answers.location_set %}
|
||||||
<div id="map" style="height: 800px; width: 100%"></div>
|
<div id="map" style="height: 800px; width: 100%"></div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user