def report_config(self): return dict(domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=get_country_id(self.domain), program='', products='')
def report_config(self): return dict( domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=get_country_id(self.domain), program='', products='' )
def report_config(self): location_id = self.request.GET.get('location_id') return dict(domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=location_id if location_id else get_country_id(self.domain), program='', products='')
def report_config(self): location_id = self.request.GET.get('location_id') return dict( domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=location_id if location_id else get_country_id(self.domain), program='', products='' )
def report_config(self): program = self.request.GET.get('filter_by_program') return dict( domain=self.domain, startdate=self.datespan.startdate, enddate=self.datespan.enddate, location_id=self.request.GET.get('location_id') or get_country_id(self.domain), products=None, program=program if program != ALL_OPTION else None, )
def report_config(self): startdate, enddate = calculate_last_period(datetime.utcnow()) return dict( domain=self.domain, startdate=startdate, enddate=enddate, location_id=self.request.GET.get('location_id') or get_country_id(self.domain), user=self.request.couch_user, program=None, products=None )
def report_config(self): program = self.request.GET.get('filter_by_program') return dict(domain=self.domain, startdate=self.datespan.startdate, enddate=self.datespan.enddate, location_id=self.request.GET.get('location_id') or get_country_id(self.domain), products=None, program=program if program != ALL_OPTION else None, user=self.request.couch_user, datespan_type=self.request.GET.get('datespan_type'), is_rendered_as_email=self.is_rendered_as_email)
def report_config(self): program = self.request.GET.get('filter_by_program') products = self.request.GET.getlist('filter_by_product') location_id = self.request.GET.get('location_id') return dict( domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=location_id if location_id else get_country_id(self.domain), program=program if program != ALL_OPTION else None, products=products if products and products[0] != ALL_OPTION else [], report_type=self.request.GET.get('report_type', None) )
def report_config(self): program = self.request.GET.get('filter_by_program') return dict( domain=self.domain, startdate=self.datespan.startdate, enddate=self.datespan.enddate, location_id=self.request.GET.get('location_id') or get_country_id(self.domain), products=None, program=program if program != ALL_OPTION else None, user=self.request.couch_user, datespan_type=self.request.GET.get('datespan_type'), is_rendered_as_email=self.is_rendered_as_email )
def get_url(cls, domain=None, render_as=None, **kwargs): url = super(EWSMapReport, cls).get_url(domain=domain, render_as=None, kwargs=kwargs) request = kwargs.get('request') user = getattr(request, 'couch_user', None) if user: product = SQLProduct.objects.filter(domain=domain, is_archived=False).\ values_list('product_id', flat=True).order_by('name') url = '%s?location_id=%s&product_id=%s' % ( url, user.location_id if user.location_id else get_country_id(domain), product[0] if product else '') return url
def get_url(cls, domain=None, render_as=None, **kwargs): url = super(EWSMapReport, cls).get_url(domain=domain, render_as=None, kwargs=kwargs) request = kwargs.get('request') user = getattr(request, 'couch_user', None) if user: product = SQLProduct.objects.filter(domain=domain, is_archived=False).\ values_list('product_id', flat=True).order_by('name') url = '%s?location_id=%s&product_id=%s' % ( url, user.location_id if user.location_id else get_country_id(domain), product[0] if product else '' ) return url
def report_config(self): program = self.request.GET.get('filter_by_program') products = self.request.GET.getlist('filter_by_product') location_id = self.request.GET.get('location_id') return dict(domain=self.domain, startdate=self.datespan.startdate_utc, enddate=self.datespan.enddate_utc, location_id=location_id if location_id else get_country_id(self.domain), program=program if program != ALL_OPTION else None, products=products if products and products[0] != ALL_OPTION else [], report_type=self.request.GET.get('report_type', None), user=self.request.couch_user, export=False, is_rendered_as_email=self.is_rendered_as_email)
def get_url(cls, domain=None, render_as=None, **kwargs): url = super(EWSMapReport, cls).get_url(domain=domain, render_as=None, kwargs=kwargs) request = kwargs.get("request") user = getattr(request, "couch_user", None) if user: product = ( SQLProduct.objects.filter(domain=domain, is_archived=False) .values_list("product_id", flat=True) .order_by("name") ) url = "%s?location_id=%s&product_id=%s" % ( url, user.location_id if user.location_id else get_country_id(domain), product[0] if product else "", ) return url
def location(self): return SQLLocation.objects.get( location_id=(self.request.GET.get('location_id') or get_country_id(self.domain)))
def default_location_id(self): return get_country_id(self.domain)
def location(self): return SQLLocation.objects.get( location_id=(self.request.GET.get('location_id') or get_country_id(self.domain)) )