Customized PlaceListView to provide data for map rendering.
This commit is contained in:
parent
cad53c070c
commit
d44bf0c0f2
@ -55,6 +55,12 @@ class PlaceListView(IsAuthenticated, ListView):
|
|||||||
template_name = 'place/place_list.html'
|
template_name = 'place/place_list.html'
|
||||||
ordering = ['name']
|
ordering = ['name']
|
||||||
|
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
print(context)
|
||||||
|
context['place_map_center'] = Place.average_latlon(self.get_queryset())
|
||||||
|
return context
|
||||||
|
|
||||||
class PlaceDetailView(IsAuthenticated, View):
|
class PlaceDetailView(IsAuthenticated, View):
|
||||||
def get(self, request, pk):
|
def get(self, request, pk):
|
||||||
place = Place.objects.get(pk=pk)
|
place = Place.objects.get(pk=pk)
|
||||||
|
Loading…
Reference in New Issue
Block a user