def available_domains(self): if not self.couch_user: return [] indicator_domains = set(get_indicator_domains()) indicator_domains = indicator_domains.difference([self.domain]) return [ d for d in indicator_domains if self.couch_user.has_permission(d, Permissions.edit_data) ]
def default_admin(request, domain, template="reports/base_template.html", **kwargs): if request.domain not in get_indicator_domains(): raise Http404 from corehq.apps.indicators.admin import BaseIndicatorAdminInterface context = dict( domain=domain, project=domain, report=dict( title="Select an Indicator Definition Type", show=True, slug=None, is_async=True, section_name=BaseIndicatorAdminInterface.section_name, ) ) return render(request, template, context)
def handle(self, *args, **options): xform_db = XFormInstance.get_db() for domain in get_indicator_domains(): namespaces = get_namespaces(domain) indicators = [] for namespace in namespaces: indicators.extend(FormIndicatorDefinition.get_all(namespace, domain)) form_ids = get_form_ids_by_type(domain, 'XFormInstance', start=datetime.date(2013, 8, 1), end=datetime.date(2013, 10, 15)) for doc in iter_docs(xform_db, form_ids): xfrom_doc = XFormInstance.wrap(doc) xfrom_doc.update_indicators_in_bulk(indicators, logger=logging)
def default_admin(request, domain, template="reports/base_template.html", **kwargs): if request.domain not in get_indicator_domains(): raise Http404 from corehq.apps.indicators.admin import BaseIndicatorAdminInterface context = dict(domain=domain, project=domain, report=dict( title="Select an Indicator Definition Type", show=True, slug=None, is_async=True, section_name=BaseIndicatorAdminInterface.section_name, )) return render(request, template, context)
def handle(self, *args, **options): xform_db = XFormInstance.get_db() for domain in get_indicator_domains(): namespaces = get_namespaces(domain) indicators = [] for namespace in namespaces: indicators.extend( FormIndicatorDefinition.get_all(namespace, domain)) key = [domain, "by_type", "XFormInstance"] data = xform_db.view('couchforms/all_submissions_by_domain', startkey=key + ["2013-08-01"], endkey=key + ["2013-10-15"], reduce=False, include_docs=False).all() form_ids = [d['id'] for d in data] for doc in iter_docs(xform_db, form_ids): xfrom_doc = XFormInstance.wrap(doc) xfrom_doc.update_indicators_in_bulk(indicators, logger=logging)
def handle(self, *args, **options): xform_db = XFormInstance.get_db() for domain in get_indicator_domains(): namespaces = get_namespaces(domain) indicators = [] for namespace in namespaces: indicators.extend(FormIndicatorDefinition.get_all(namespace, domain)) key = [domain, "by_type", "XFormInstance"] data = xform_db.view( 'couchforms/all_submissions_by_domain', startkey=key+["2013-08-01"], endkey=key+["2013-10-15"], reduce=False, include_docs=False ).all() form_ids = [d['id'] for d in data] for doc in iter_docs(xform_db, form_ids): xfrom_doc = XFormInstance.wrap(doc) xfrom_doc.update_indicators_in_bulk(indicators, logger=logging)
def extra_args(self): return { 'domains': ' '.join(get_indicator_domains()), 'doc_type': self.document_class._doc_type, }
def is_viewable(self): indicator_enabled_projects = get_indicator_domains() return self.couch_user.can_edit_data() and self.domain in indicator_enabled_projects
def is_viewable(self): indicator_enabled_projects = get_indicator_domains() return self.couch_user.can_edit_data( ) and self.domain in indicator_enabled_projects
def available_domains(self): if not self.couch_user: return [] indicator_domains = set(get_indicator_domains()) indicator_domains = indicator_domains.difference([self.domain]) return [d for d in indicator_domains if self.couch_user.has_permission(d, Permissions.edit_data)]
def domains(self): return get_indicator_domains()
def extra_args(self): return { 'domains': ' '.join(get_indicator_domains()), 'doc_types': ' '.join([self._main_doc_type] + self._deleted_doc_types), }