Provide Google Maps link for desktop users
This commit is contained in:
parent
8dcf4512cc
commit
b318270fb0
1 changed files with 12 additions and 10 deletions
22
gym/views.py
22
gym/views.py
|
@ -44,18 +44,20 @@ class RoomDetailView(LoginRequiredMixin, QuickActionsMixin, SessionResetMixin, g
|
||||||
if self.object.latitude and self.object.longitude:
|
if self.object.latitude and self.object.longitude:
|
||||||
from user_agents import parse
|
from user_agents import parse
|
||||||
user_agent = parse(self.request.META.get('HTTP_USER_AGENT'))
|
user_agent = parse(self.request.META.get('HTTP_USER_AGENT'))
|
||||||
|
|
||||||
if user_agent.is_mobile:
|
if user_agent.is_mobile:
|
||||||
quick_actions.append({
|
url = f"waze://?ll={self.object.latitude},{self.object.longitude}&navigate=yes"
|
||||||
'url': f"waze://?ll={self.object.latitude},{self.object.longitude}&navigate=yes",
|
name = 'Waze'
|
||||||
'category': 'info',
|
|
||||||
'display': 'Waze'
|
|
||||||
})
|
|
||||||
else:
|
else:
|
||||||
quick_actions.append({
|
url = (f"https://www.google.com/maps/place/{self.object.latitude},{self.object.longitude}"
|
||||||
'url': f"https://waze.com/ul?ll={self.object.latitude},{self.object.longitude}",
|
f"/@{self.object.latitude},{self.object.longitude},18z")
|
||||||
'category': 'info',
|
name = 'Google Maps'
|
||||||
'display': 'Waze'
|
|
||||||
})
|
quick_actions.append({
|
||||||
|
'url': url,
|
||||||
|
'category': 'info',
|
||||||
|
'display': name
|
||||||
|
})
|
||||||
return quick_actions
|
return quick_actions
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue