fix: hide map on detail pages when no location set

This commit is contained in:
James Graham
2021-04-26 21:04:02 +01:00
parent fa6a4339d8
commit 311a90fe09
5 changed files with 20 additions and 6 deletions

View File

@@ -188,6 +188,10 @@ class PersonAnswerSet(AnswerSet):
#: Longitude for displaying location on a map
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:
"""Get answers to questions which are public."""
return self.question_answers.filter(question__answer_is_public=True)