From 65dfc6560fdfbb40b42a958d2b88c36f4fcda95b Mon Sep 17 00:00:00 2001
From: Steven H Johnson <shjohnson.pi@gmail.com>
Date: Fri, 17 Jun 2016 15:07:15 -0400
Subject: [PATCH] Order hotels by name and move Radisson to top

---
 usta/templates/usta/map.html | 9 +++++++++
 usta/views.py                | 7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/usta/templates/usta/map.html b/usta/templates/usta/map.html
index adeadfd..7c75928 100644
--- a/usta/templates/usta/map.html
+++ b/usta/templates/usta/map.html
@@ -103,6 +103,15 @@
                         <th class="map-phone">Phone</th>
                         <th class="map-description">Description</th>
                     </tr>
+                    {% if radisson %}{# Host hotel comes first #}
+                    <tr>
+                        <td class="">{% if radisson.link %}<a href="{{ radisson.link }}">{% endif %}{{ radisson.name }}{% if radisson.link %}</a>{% endif %}</td>
+                        <td class=" map-address"><a target="_blank" title="Directions" href='http://maps.google.com/?q=%22{{ radisson.address|urlencode:"" }}%22'>{{ radisson.address }}</a></td>
+                        <td class="">{{ radisson.rate }}</td>
+                        <td>{{ radisson.phone }}</td>
+                        <td class="map-description">{{ radisson.description }}</td>
+                    </tr>
+                    {% endif %}
                     {% for location in places %}
                     <tr>
                         <td class="">{% if location.link %}<a href="{{ location.link }}">{% endif %}{{ location.name }}{% if location.link %}</a>{% endif %}</td>
diff --git a/usta/views.py b/usta/views.py
index 12b0db8..a692f71 100644
--- a/usta/views.py
+++ b/usta/views.py
@@ -244,19 +244,24 @@ def map_view(request):
         letter = MapLocation.static_get_category_letter(category)
         icon = 'images/map_pins/{0}.png'.format(letter.lower())
         key = (name, name.replace(' ', '_'), icon)
-        locations[key] = MapLocation.objects.filter(category=category)
+        locations[key] = MapLocation.objects.filter(
+            category=category).order_by('name').exclude(
+                name__contains="Radisson")
     map_center = "{lat: 42.291, lng: -85.598}"
 
     site_settings = get_site_settings()
     hotels_information = site_settings.get_setting('hotels_document', None)
     parking_information = site_settings.get_setting('parking_document', None)
 
+    radisson = MapLocation.objects.filter(name__contains="Radisson").first()
+
     return render(request, 'usta/map.html', {
         'locations': locations,
         'map_center': map_center,
         'GOOGLE_API_KEY': getattr(settings, 'GOOGLE_API_KEY', ''),
         'hotels_information': hotels_information,
         'parking_information': parking_information,
+        'radisson': radisson,
         'title': 'Map Locations',
         'show_generic': True,
     })
-- 
GitLab