mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
@@ -95,6 +95,12 @@ class Theme(models.Model):
|
||||
|
||||
class PersonQuestion(Question):
|
||||
"""Question which may be asked about a person."""
|
||||
#: Should answers to this question be displayed on public profiles?
|
||||
answer_is_public = models.BooleanField(
|
||||
help_text='Should answers to this question be displayed on profiles?',
|
||||
default=True,
|
||||
blank=False,
|
||||
null=False)
|
||||
|
||||
|
||||
class PersonQuestionChoice(QuestionChoice):
|
||||
@@ -193,6 +199,10 @@ class PersonAnswerSet(AnswerSet):
|
||||
#: Longitude for displaying location on a map
|
||||
longitude = models.FloatField(blank=True, null=True)
|
||||
|
||||
def public_answers(self) -> models.QuerySet:
|
||||
"""Get answers to questions which are public."""
|
||||
return self.question_answers.filter(question__answer_is_public=True)
|
||||
|
||||
def as_dict(self):
|
||||
"""Get the answers from this set as a dictionary for use in Form.initial."""
|
||||
exclude_fields = {
|
||||
|
||||
Reference in New Issue
Block a user