Scott Baker | c7325a4 | 2014-05-30 16:06:46 -0700 | [diff] [blame] | 1 | from view_common import * |
Scott Baker | 823b721 | 2014-06-16 10:25:39 -0700 | [diff] [blame] | 2 | import random |
Scott Baker | 0906612 | 2015-02-02 16:12:47 -0800 | [diff] [blame] | 3 | from planetstack_analytics import DoPlanetStackAnalytics |
Scott Baker | c7325a4 | 2014-05-30 16:06:46 -0700 | [diff] [blame] | 4 | |
| 5 | class DashboardAnalyticsAjaxView(View): |
Scott Baker | d3a1012 | 2015-02-02 16:23:52 -0800 | [diff] [blame] | 6 | url = r'^analytics/(?P<name>\w+)/$' |
| 7 | |
Scott Baker | c7325a4 | 2014-05-30 16:06:46 -0700 | [diff] [blame] | 8 | def get(self, request, name="hello_world", **kwargs): |
Scott Baker | 4879fca | 2014-05-30 16:10:35 -0700 | [diff] [blame] | 9 | if (name == "bigquery"): |
Scott Baker | c7325a4 | 2014-05-30 16:06:46 -0700 | [diff] [blame] | 10 | (mimetype, data) = DoPlanetStackAnalytics(request) |
Scott Baker | 823b721 | 2014-06-16 10:25:39 -0700 | [diff] [blame] | 11 | return HttpResponse(data, content_type=mimetype) |
Scott Baker | c7325a4 | 2014-05-30 16:06:46 -0700 | [diff] [blame] | 12 | else: |
Scott Baker | 823b721 | 2014-06-16 10:25:39 -0700 | [diff] [blame] | 13 | return HttpResponse(json.dumps("Unknown"), content_type='application/javascript') |