From 9496f21834f317293b83ba06e64c991e3384f756 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 9 Sep 2024 22:56:45 +0000 Subject: [PATCH] fix #217 and add heatmap --- auctions/management/commands/info.py | 5 +++-- auctions/templates/base_page_view.html | 9 +++++++++ auctions/templates/user_map.html | 21 ++++++++++++++++++++- auctions/views.py | 9 +++++++++ 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/auctions/management/commands/info.py b/auctions/management/commands/info.py index 70638e6..67daee9 100644 --- a/auctions/management/commands/info.py +++ b/auctions/management/commands/info.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand -from auctions.models import find_image +from auctions.models import UserData def compare_model_instances(instance1, instance2): @@ -29,7 +29,8 @@ def compare_model_instances(instance1, instance2): class Command(BaseCommand): help = "Just a scratchpad to do things" - print(find_image("blue shrimp", None)) + d = UserData.objects.get(user__username="ira") + print(d.unsubscribe_link) # def handle(self, *args, **options): # campaigns = AuctionCampaign.objects.all() # for campaign in campaigns: diff --git a/auctions/templates/base_page_view.html b/auctions/templates/base_page_view.html index e300514..49f8c92 100644 --- a/auctions/templates/base_page_view.html +++ b/auctions/templates/base_page_view.html @@ -3,13 +3,22 @@ @@ -51,6 +51,24 @@ } })(marker, i)); } + // Heat map + var map = new google.maps.Map(document.getElementById("map_visualization"), { + zoom: 5, + center: { lat: 39.095963, lng: -83.662005 }, + }); + + var heatmapData = [ + {% for view in pageviews %} + new google.maps.LatLng({{ view.latitude}}, {{ view.longitude}}), + {% endfor %} + ]; + + var heatmap = new google.maps.visualization.HeatmapLayer({ + data: heatmapData, + radius: 20, + }); + + heatmap.setMap(map); } {% endblock %} @@ -58,6 +76,7 @@