Exemplo n.º 1
0
    def render(self, *args, **kwargs):
        user_id = args[0]
        current = int(args[1])
        # kind
        # current 当前页面

        num_of_cat = MLog.count_of_certain(user_id)

        tmp_page_num = int(num_of_cat / config.CMS_CFG['list_num'])

        page_num = (tmp_page_num if
                    abs(tmp_page_num - num_of_cat / config.CMS_CFG['list_num'])
                    < 0.1 else tmp_page_num + 1)

        kwd = {
            'page_home': False if current <= 1 else True,
            'page_end': False if current >= page_num else True,
            'page_pre': False if current <= 1 else True,
            'page_next': False if current >= page_num else True,
        }

        return self.render_string('modules/admin/log_admin_pager.html',
                                  kwd=kwd,
                                  user_id=user_id,
                                  pager_num=page_num,
                                  page_current=current)
Exemplo n.º 2
0
    def render(self, *args, **kwargs):
        user_id = args[0]
        current = int(args[1])

        the_count = MLog.count_of_certain(user_id)

        pager_count = int(the_count / config.CMS_CFG['list_num'])

        page_num = (pager_count if
                    abs(pager_count - the_count / config.CMS_CFG['list_num']) <
                    0.1 else pager_count + 1)

        kwd = {
            'page_home': False if current <= 1 else True,
            'page_end': False if current >= page_num else True,
            'page_pre': False if current <= 1 else True,
            'page_next': False if current >= page_num else True,
        }

        return self.render_string('modules/admin/log_pager.html',
                                  kwd=kwd,
                                  user_id=user_id,
                                  pager_num=page_num,
                                  page_current=current)
Exemplo n.º 3
0
 def test_count_of_certain(self):
     MLog.count_of_certain(self.userid)
     assert True
Exemplo n.º 4
0
 def test_count_of_certain(self):
     a = MLog.count_of_certain(self.userid)
     self.add_message()
     b = MLog.count_of_certain(self.userid)
     assert a >= b - 1
     self.tearDown()
Exemplo n.º 5
0
 def test_count_of_certain(self):
     MLog.count_of_certain('None')
     assert True