Esempio n. 1
0
    def comments(self):
        inputParams = self.getInput()
        page = int(inputParams['page']) if inputParams.has_key('page') else 1
        count = config.COUNT_PER_PAGE
###评论是都能看到
        groupCommentList = GroupComments.select()
        pageString = self.getPageStr('/admin/groups/comments', page, count, groupCommentList.count())
        self.privData['GROUPCOMM_LIST'] = groupCommentList.order_by(GroupComments.id.desc()).paginate(page, count)
        self.privData['PAGE_STRING'] = pageString

        return self.display('groupcommViewList')
Esempio n. 2
0
    def commdelete(self):
        inputParams = self.getInput()
        groupcomm = GroupComments.get(GroupComments.id == int(inputParams['id']))

        current_user = Users.get(Users.name == self.isLogin())
        if current_user.id != groupcomm.owner.id and not self.isAdmin() or not current_user.role.type < 100:
            return self.error(msg = '权限不足!', url=self.makeUrl('/admin/groups/comments'))

        try:
            groupcomm.delete_instance()
        except Exception, e:
            return self.success(msg='公司评论删除失败: %s' % e, url=self.makeUrl('/admin/groups/comments'))
Esempio n. 3
0
    def commupdate(self):
        inputParams= self.getInput()
        groupcomm = GroupComments.get(GroupComments.id == int(inputParams['id']))

        current_user = Users.get(Users.name == self.isLogin())
        if current_user.id != groupcomm.owner.id and not self.isAdmin() or  not current_user.role.type < 100:
            return self.error(msg = '权限不足!', url=self.makeUrl('/admin/groups/list'))

        try:
            groupcomm.content = inputParams['content']
            ##现在时间没有更新,需要更新时间为当前时间
            groupcomm.save()
        except Exception, e:
            return self.error(msg = '公司评论修改失败: %s' % e, url=self.makeUrl('/admin/groups/comments'))