Adapting home view

This commit is contained in:
reverend 2020-09-12 11:47:42 +02:00
parent e1002b5315
commit a1886b0b60
2 changed files with 7 additions and 5 deletions

View File

@ -2,8 +2,8 @@
{% load static %} {% load static %}
{% block additional_head %} {% block additional_head %}
<link rel="stylesheet" href="{% static 'maps/ol.css' %}" type="text/css"> <link rel="stylesheet" href="{% static 'maps/ol.css' %}" type="text/css">
<script src="{% static 'maps/ol.js' %}"></script> <script src="{% static 'maps/ol.js' %}"></script>
{% endblock additional_head %} {% endblock additional_head %}
# {% block title %}Start{% endblock %} # {% block title %}Start{% endblock %}
@ -14,7 +14,7 @@
<article class="LP-TextSection"> <article class="LP-TextSection">
</article> </article>
{% include 'partials/osm_map.html' %} {% include 'partials/osm_map.html' with config=map_config %}
<div class="LP-PlaceGrid"> <div class="LP-PlaceGrid">
<h1 class="LP-Headline LP-Headline">Explore the latest locations</h1> <h1 class="LP-Headline LP-Headline">Explore the latest locations</h1>
<ul class="LP-PlaceGrid__Grid"> <ul class="LP-PlaceGrid__Grid">

View File

@ -27,10 +27,12 @@ class SignUpView(SuccessMessageMixin, CreateView):
class HomeView(IsAuthenticated, View): class HomeView(IsAuthenticated, View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
place_list = Place.objects.all().order_by('-submitted_when')[:10] place_list = Place.objects.all().order_by('-submitted_when')[:10]
place_map_center = Place.average_latlon(place_list)
context = { context = {
'place_list': place_list, 'place_list': place_list,
'place_map_center': place_map_center 'map_config': {
'point_list': place_list,
'map_center': Place.average_latlon(place_list)
}
} }
return render(request, 'home.html', context) return render(request, 'home.html', context)