Ejemplo n.º 1
0
    def _init_navigation(self):
        nav = Navigation(self)

        base_url = '%s?year=%d&month=%d&day=%d&per_page=%d' % (
                     self.url_for(self.name + '.html'),
                     self.focus_datetime.year,
                     self.focus_datetime.month,
                     self.focus_datetime.day,
                     self.per_page)      

        # today_url
        if self.page == 1:
            nav.today_url = None
        else:
            nav.today_url = base_url + "&page=1"

        # prev_url
        if self.page == 1:
            nav.prev_url = None
        else:                                                
            prev_page = self.page - 1
            nav.prev_url = base_url + ("&page=%d" % prev_page)

        # next_url
        if not self.has_more:
            nav.next_url = None
        else:
            next_page = self.page + 1
            nav.next_url = base_url + ("&page=%d" % next_page)
            
        self.navigation = nav    
Ejemplo n.º 2
0
Archivo: list.py Proyecto: iotest3/new
    def _init_navigation(self):
        nav = Navigation(self)

        base_url = '%s?year=%d&month=%d&day=%d&per_page=%d' % (
                     self.url_for(self.name + '.html'),
                     self.focus_datetime.year,
                     self.focus_datetime.month,
                     self.focus_datetime.day,
                     self.per_page)

        if self.nav_params:
            base_url += '&%s' % urlencode(self.nav_params)

        # today_url
        if self.page == 1:
            nav.today_url = None
        else:
            nav.today_url = base_url + "&page=1"

        # prev_url
        if self.page == 1:
            nav.prev_url = None
        else:
            prev_page = self.page - 1
            nav.prev_url = base_url + ("&page=%d" % prev_page)

        # next_url
        if not self.has_more:
            nav.next_url = None
        else:
            next_page = self.page + 1
            nav.next_url = base_url + ("&page=%d" % next_page)

        self.navigation = nav
Ejemplo n.º 3
0
    def _init_navigation(self):
        nav = Navigation(self)

        # left side
        url = self.url_for(self.name + '.html')
        fmt = '%s?year=%d&month=%d&day=%d%s'

        if self.nav_params:
            extra = '&%s' % urlencode(self.nav_params)
        else:
            extra = ''

        nav.prev_url = fmt % (url, self.prev_datetime.year,
                                      self.prev_datetime.month,
                                      self.prev_datetime.day,
                                      extra)

        nav.next_url = fmt % (url, self.next_datetime.year,
                                      self.next_datetime.month,
                                      self.next_datetime.day,
                                      extra)

        if not self._is_today_shown():
            nav.today_url = fmt % (url, self.now_datetime.year,
                                           self.now_datetime.month,
                                           self.now_datetime.day,
                                           extra)

        self.navigation = nav
Ejemplo n.º 4
0
    def _init_navigation(self):
        nav = Navigation(self)

        # left side
        url = self.url_for(self.name + '.html')
        fmt = '%s?year=%d&month=%d&day=%d%s'

        if self.nav_params:
            extra = '&%s' % urlencode(self.nav_params)
        else:
            extra = ''

        nav.prev_url = fmt % (url, self.prev_datetime.year,
                              self.prev_datetime.month, self.prev_datetime.day,
                              extra)

        nav.next_url = fmt % (url, self.next_datetime.year,
                              self.next_datetime.month, self.next_datetime.day,
                              extra)

        if not self._is_today_shown():
            nav.today_url = fmt % (url, self.now_datetime.year,
                                   self.now_datetime.month,
                                   self.now_datetime.day, extra)

        self.navigation = nav
Ejemplo n.º 5
0
    def _init_navigation(self):
        nav = Navigation(self)

        # left side
        url = self.url_for(self.name + '.html')
        format = '%s?year=%d&month=%d&day=%d'

        nav.prev_url = format % (url, self.prev_datetime.year, 
                                      self.prev_datetime.month,
                                      self.prev_datetime.day)

        nav.next_url = format % (url, self.next_datetime.year, 
                                      self.next_datetime.month,
                                      self.next_datetime.day)
        
        if not self._is_today_shown():                                      
            nav.today_url = format % (url, self.now_datetime.year,
                                           self.now_datetime.month,
                                           self.now_datetime.day)
                                                      
        self.navigation = nav