mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
refactor: add map marker to context on update
This commit is contained in:
@@ -57,7 +57,8 @@ class ProfileView(permissions.UserIsLinkedPersonMixin, DetailView):
|
||||
# pk was not provided in URL
|
||||
return self.request.user.person
|
||||
|
||||
def get_context_data(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
||||
def get_context_data(self,
|
||||
**kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
||||
"""Add current :class:`PersonAnswerSet` to context."""
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
@@ -74,6 +75,14 @@ class PersonUpdateView(permissions.UserIsLinkedPersonMixin, UpdateView):
|
||||
template_name = 'people/person/update.html'
|
||||
form_class = forms.PersonAnswerSetForm
|
||||
|
||||
def get_context_data(self,
|
||||
**kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
context['map_markers'] = [get_map_data(self.object)]
|
||||
|
||||
return context
|
||||
|
||||
def get_initial(self) -> typing.Dict[str, typing.Any]:
|
||||
return {
|
||||
'person_id': self.object.id,
|
||||
@@ -129,7 +138,8 @@ class PersonMapView(LoginRequiredMixin, ListView):
|
||||
model = models.Person
|
||||
template_name = 'people/person/map.html'
|
||||
|
||||
def get_context_data(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
||||
def get_context_data(self,
|
||||
**kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
context['map_markers'] = [
|
||||
|
||||
Reference in New Issue
Block a user