def permissions_check(self, report, request, domain=None, is_navigation_check=False): from corehq.motech.repeaters.views import DomainForwardingRepeatRecords from corehq.apps.export.views.incremental import IncrementalExportLogView from corehq.toggles import INCREMENTAL_EXPORTS if (report.endswith(DomainForwardingRepeatRecords.__name__) and not domain_has_privilege(domain, privileges.DATA_FORWARDING)): return False if (report.endswith(IncrementalExportLogView.__name__) and not INCREMENTAL_EXPORTS.enabled(domain)): return False return super(DomainReportDispatcher, self).permissions_check(report, request, domain, is_navigation_check)
from corehq.apps.export.models.incremental import ( IncrementalExport, IncrementalExportCheckpoint, generate_and_send_incremental_export, ) from corehq.apps.reports.datatables import DataTablesColumn, DataTablesHeader from corehq.apps.reports.dispatcher import DomainReportDispatcher from corehq.apps.reports.generic import GenericTabularReport from corehq.apps.reports.standard import DatespanMixin from corehq.apps.settings.views import BaseProjectDataView from corehq.apps.hqwebapp.views import CRUDPaginatedViewMixin from corehq.motech.views import MotechLogDetailView from corehq.toggles import INCREMENTAL_EXPORTS @method_decorator(INCREMENTAL_EXPORTS.required_decorator(), name="dispatch") class IncrementalExportView(BaseProjectDataView, CRUDPaginatedViewMixin): page_title = _("Incremental Export") urlname = "incremental_export_view" template_name = "export/incremental_export.html" @property def total(self): # How many documents are you paginating through? return self.base_query.count() @property def base_query(self): return IncrementalExport.objects.filter(domain=self.domain)