Skip to content

Instantly share code, notes, and snippets.

@aparakian
Created October 9, 2015 17:19
Show Gist options
  • Save aparakian/80bfcdda60487c96c40d to your computer and use it in GitHub Desktop.
Save aparakian/80bfcdda60487c96c40d to your computer and use it in GitHub Desktop.
try signed_request require_superadmin
from w4.views.generic import PageView
from w4.utils.http.request import require_superadmin, assert_signed_request
from analytics_app.redshift.reports.app_reporting import AppReportGeneral, AppReportDevice
class AppReportingView(PageView):
template_name = "app_reporting.html"
@assert_signed_request('uid')
@require_superadmin
def dispatch(self, request, *args, **kwargs):
super(AppReportingView, self).dispatch(request, *args, **kwargs)
def get_context_data(self, request, page, **kwargs):
report_general_html = self.data_frame_to_html(self.get_app_general_reporting("255950084564962"))
report_device_html = self.data_frame_to_html(self.get_app_device_reporting("255950084564962"))
return {
"report_general_html": report_general_html,
"report_device_html": report_device_html
}
@staticmethod
def get_app_general_reporting(page_id):
return AppReportGeneral(page_id).read()
@staticmethod
def get_app_device_reporting(page_id):
return AppReportDevice(page_id).read()
@staticmethod
def format_data_frame(report):
pass
@staticmethod
def data_frame_to_html(report):
return report.to_html(index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment