mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
@@ -24,8 +24,25 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<a class="btn btn-success"
|
||||
href="{% url 'people:organisation.update' pk=organisation.pk %}">Update</a>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-3">
|
||||
<a class="btn btn-warning btn-block"
|
||||
href="{% url 'people:organisation.update' pk=organisation.pk %}">Update Organisation</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
{% if relationship %}
|
||||
<a class="btn btn-warning btn-block"
|
||||
href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">Update Relationship
|
||||
</a>
|
||||
|
||||
{% else %}
|
||||
<a class="btn btn-success btn-block"
|
||||
href="{% url 'people:organisation.relationship.create' organisation_pk=organisation.pk %}">New Relationship
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -24,6 +24,23 @@
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-3">
|
||||
{% if relationship %}
|
||||
<a class="btn btn-warning btn-block"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">Update Relationship
|
||||
</a>
|
||||
|
||||
{% else %}
|
||||
<a class="btn btn-success btn-block"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">New Relationship
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
{% if person.user != request.user and request.user.is_superuser %}
|
||||
<div class="alert alert-warning">
|
||||
<strong>NB:</strong> You are able to see the details of this person because you are an admin.
|
||||
|
||||
@@ -22,9 +22,22 @@
|
||||
|
||||
<h1>{{ person.name }}</h1>
|
||||
|
||||
<a class="btn btn-success"
|
||||
<hr>
|
||||
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col-md-3">
|
||||
{% if relationship %}
|
||||
<a class="btn btn-warning btn-block"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">Update Relationship
|
||||
</a>
|
||||
|
||||
{% else %}
|
||||
<a class="btn btn-success btn-block"
|
||||
href="{% url 'people:person.relationship.create' person_pk=person.pk %}">New Relationship
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
|
||||
@@ -106,10 +106,13 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView):
|
||||
context_object_name = 'organisation'
|
||||
template_name = 'people/organisation/detail.html'
|
||||
|
||||
def build_question_answers(self, answer_set: models.OrganisationAnswerSet) -> typing.Dict[str, str]:
|
||||
def build_question_answers(
|
||||
self,
|
||||
answer_set: models.OrganisationAnswerSet) -> typing.Dict[str, str]:
|
||||
"""Collect answers to dynamic questions and join with commas."""
|
||||
show_all = self.request.user.is_superuser
|
||||
questions = models.OrganisationQuestion.objects.filter(is_hardcoded=False)
|
||||
questions = models.OrganisationQuestion.objects.filter(
|
||||
is_hardcoded=False)
|
||||
if not show_all:
|
||||
questions = questions.filter(answer_is_public=True)
|
||||
|
||||
@@ -139,6 +142,14 @@ class OrganisationDetailView(LoginRequiredMixin, DetailView):
|
||||
'lng': getattr(answerset, 'longitude', None),
|
||||
}]
|
||||
|
||||
context['relationship'] = None
|
||||
try:
|
||||
context['relationship'] = models.OrganisationRelationship.objects.get(
|
||||
source=self.request.user.person, target=self.object) # yapf: disable
|
||||
|
||||
except models.OrganisationRelationship.DoesNotExist:
|
||||
pass
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
||||
@@ -123,6 +123,14 @@ class ProfileView(LoginRequiredMixin, DetailView):
|
||||
context['question_answers'] = self.build_question_answers(answer_set)
|
||||
context['map_markers'] = [get_map_data(self.object)]
|
||||
|
||||
context['relationship'] = None
|
||||
try:
|
||||
context['relationship'] = models.Relationship.objects.get(
|
||||
source=self.request.user.person, target=self.object)
|
||||
|
||||
except models.Relationship.DoesNotExist:
|
||||
pass
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user