1 from django.http import HttpResponse
2 from madrona.common.views import map
3 from madrona.bookmarks.models import Bookmark
4 from django.contrib.auth.models import User
5 from django.core.urlresolvers import reverse
6 from django.contrib.sites.models import Site
7 from django.conf import settings
8 from madrona.common.utils import get_logger
9 import datetime
10 import urlparse
11
12 log = get_logger()
13
15 return s[0].lower() + s[1:]
16
17 domain = "http://%s" % Site.objects.get_current().domain
18
20 try:
21 b = Bookmark.objects.get(pk=bookmark_id)
22 except Bookmark.DoesNotExist:
23 return HttpResponse("<h3> Unable to find <em>bookmark %s</em>... please check URL </h3>" % bookmark_id, status=404)
24
25 get = request.GET.copy()
26 camera_params = ["Latitude", "Longitude", "Altitude", "Heading", "Tilt", "Roll", "AltitudeMode", 'publicstate']
27 for p in camera_params:
28 get[p] = b.__dict__[lower_first(p)]
29 request.GET = get
30 return map(request)
31
33 try:
34 b = Bookmark.objects.get(pk=bookmark_id)
35 except Bookmark.DoesNotExist:
36 return HttpResponse("<h3> Unable to find <em>bookmark %s</em>... please check URL </h3>" % bookmark_id, status=404)
37
38 state = b.publicstate
39 response = HttpResponse(state, status=200)
40 response.ContentType = "application/json"
41 return response
42
77