def _dispatcher(self): from corehq.apps.userreports.models import CUSTOM_REPORT_PREFIX from corehq.apps.userreports.reports.view import ( ConfigurableReportView, CustomConfigurableReportDispatcher, ) dispatchers = [ ProjectReportDispatcher, CustomProjectReportDispatcher, ] for dispatcher in dispatchers: if dispatcher.prefix == self.report_type: return dispatcher() if self.report_type == 'configurable': if self.subreport_slug.startswith(CUSTOM_REPORT_PREFIX): return CustomConfigurableReportDispatcher() else: return ConfigurableReportView() if self.doc_type != 'ReportConfig-Deleted': self.doc_type += '-Deleted' self.save() notify_exception( None, "This saved-report (id: %s) is unknown (report_type: %s) and so we have archived it" % (self._id, self.report_type)) raise UnsupportedSavedReportError("Unknown dispatcher: %s" % self.report_type)
delete_scheduled_report, send_test_scheduled_report, view_scheduled_report, export_all_form_metadata, export_all_form_metadata_async, download_cases, download_cases_internal, ) custom_report_urls = [ CustomProjectReportDispatcher.url_pattern(), ] urlpatterns = [ ConfigurableReport.url_pattern(), CustomConfigurableReportDispatcher.url_pattern(), # Report Builder V2 urls url(r'^builder/select_source/$', ReportBuilderDataSourceSelect.as_view(), name=ReportBuilderDataSourceSelect.urlname), url(r'^builder/configure/$', ConfigureReport.as_view(), name=ConfigureReport.urlname), url(r'^builder/preview/(?P<data_source>[\w\-]+)/$', ReportPreview.as_view(), name=ReportPreview.urlname), # Report Builder V1 urls url(r'^builder/select_type/$', ReportBuilderTypeSelect.as_view(),
EditReportInBuilder, ReportBuilderDataSourceSelect, ReportBuilderTypeSelect, ) from .filters import urls as filter_urls from .views import EditFormInstance, AddSavedReportConfigView custom_report_urls = patterns('', CustomProjectReportDispatcher.url_pattern(), ) urlpatterns = patterns('corehq.apps.reports.views', TestReport.url_pattern(), ConfigurableReport.url_pattern(), CustomConfigurableReportDispatcher.url_pattern(), url(r'^builder/select_type/$', ReportBuilderTypeSelect.as_view(), name=ReportBuilderTypeSelect.urlname), url(r'^builder/(?P<report_type>list|chart|table|worker)/select_source/$', ReportBuilderDataSourceSelect.as_view(), name='report_builder_select_source'), url(r'^builder/configure/chart/$', ConfigureChartReport.as_view(), name="configure_chart_report"), url(r'^builder/configure/list/$', ConfigureListReport.as_view(), name="configure_list_report"), url(r'^builder/configure/table/$', ConfigureTableReport.as_view(), name="configure_table_report"), url(r'^builder/configure/worker/$', ConfigureWorkerReport.as_view(), name="configure_worker_report"), url(r'^builder/edit/(?P<report_id>[\w\-]+)/$', EditReportInBuilder.as_view(), name='edit_report_in_builder'), url(r'^$', "default", name="reports_home"), url(r'^saved/', "saved_reports", name="saved_reports"), url(r'^saved_reports', 'old_saved_reports'), url(r'^case_data/(?P<case_id>[\w\-]+)/$', 'case_details', name="case_details"), url(r'^case_data/(?P<case_id>[\w\-]+)/forms/$', 'case_forms', name="single_case_forms"),