예제 #1
0
 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='')
예제 #2
0
 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=''
     )
예제 #3
0
 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='')
예제 #4
0
 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=''
     )
예제 #5
0
 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,
     )
예제 #6
0
 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
     )
예제 #7
0
 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)
예제 #8
0
 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)
     )
예제 #9
0
 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
     )
예제 #10
0
    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
예제 #11
0
    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
예제 #12
0
 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)
예제 #13
0
    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
예제 #14
0
 def location(self):
     return SQLLocation.objects.get(
         location_id=(self.request.GET.get('location_id')
                      or get_country_id(self.domain)))
예제 #15
0
 def default_location_id(self):
     return get_country_id(self.domain)
예제 #16
0
 def default_location_id(self):
     return get_country_id(self.domain)
예제 #17
0
 def location(self):
     return SQLLocation.objects.get(
         location_id=(self.request.GET.get('location_id') or get_country_id(self.domain))
     )