Exemple #1
0
class OrderTable(tables.Table):
    sn = tables.Column(sTitle=u'单号', bSortable=False)
    #name = tables.Column(sTitle=u'名称', bSortable=False)
    user = tables.Column(sTitle=u'用户名',
                         bSortable=False,
                         accessor=lambda x: x.member.username)
    real_name = tables.Column(sTitle=u'姓名',
                              bSortable=False,
                              accessor=lambda x: x.member.real_name)
    phone = tables.Column(sTitle=u'手机',
                          bSortable=False,
                          accessor=lambda x: x.member.phone)
    room = tables.Column(sTitle=u'房号',
                         bSortable=False,
                         accessor=lambda x: x.room.name)
    room_type = tables.Column(sTitle=u'房型',
                              bSortable=False,
                              accessor=lambda x: x.room_type.name)
    price = tables.Column(sTitle=u'价格',
                          bSortable=False,
                          accessor=lambda x: x.room_type.price)
    comment = tables.Column(sTitle=u'说明', bSortable=False)
    status = tables.Column(sTitle=u'状态',
                           bSortable=False,
                           accessor=lambda x: x.get_status_display())
    action = tables.Column(sTitle=u'操作', bSortable=False,
                           accessor='view')  #tables.Table.CALLBACK)

    @classmethod
    def get_action(cls, user=None):
        actions = ['view']
        actions.append('delete')
        return ','.join(actions)
Exemple #2
0
class GroupTable(tables.Table):
    id = tables.Column(sTitle=u'ID',bSortable=False)
    name = tables.Column(sTitle=u'名称', bSortable=False)
    action= tables.Column(sTitle=u'操作', bSortable=False, accessor=tables.Table.CALLBACK)
    
    @classmethod
    def get_action(cls,room,user=None):
        actions = ['view']
        actions.append('edit')
        actions.append('delete')
        return ','.join(actions)
Exemple #3
0
class ArticleTable(tables.Table):
    title = tables.Column(sTitle=u'标题',bSortable=False)
    content = tables.Column(sTitle=u'内容', bSortable=False)
    author = tables.Column(sTitle=u'作者', bSortable=False,accessor=lambda x:x.author.username)
    status = tables.Column(sTitle=u'状态', bSortable=False,accessor=lambda x:x.get_status_display())
    edit_time = tables.Column(sTitle=u'最后编辑时间', bSortable=False)
    
    @classmethod
    def get_action(cls,user=None):
        actions = ['view']
        actions.append('edit')
        actions.append('priority')
        actions.append('low_priority')
        actions.append('delete')
        return ','.join(actions)
Exemple #4
0
class RoomTable(tables.Table):
    id = tables.Column(sTitle=u'ID', bSortable=False)
    sn = tables.Column(sTitle=u'房号', bSortable=False)
    name = tables.Column(sTitle=u'名称', bSortable=False)
    status = tables.Column(sTitle=u'状态',
                           bSortable=False,
                           accessor=lambda x: x.get_status_display())
    using = tables.Column(sTitle=u'使用者',
                          bSortable=False,
                          accessor=lambda x: x.order_user.real_name
                          if x.order_user else u'无')
    status_time = tables.Column(sTitle=u'状态时间',
                                bSortable=False,
                                accessor=lambda x: '')
    action = tables.Column(sTitle=u'操作',
                           bSortable=False,
                           accessor=tables.Table.CALLBACK)

    @classmethod
    def get_action(cls, room, user=None):
        actions = ['view']
        actions.append('edit')
        actions.append('delete')
        actions.append('set_status')
        #actions.append('order')
        '''
        if user.hasperm('room.edit_room'):
            actions.append('edit') 
        if user.hasperm('room.delete_room'):
            actions.append('delete') 
        if user.hasperm('room.add_room'):
            actions.append('add')
        '''
        return ','.join(actions)
Exemple #5
0
class UserTable(tables.Table):
    id = tables.Column(sTitle=u'ID',bSortable=False)
    username = tables.Column(sTitle=u'用户名', bSortable=False)
    real_name = tables.Column(sTitle=u'姓名', bSortable=False)
    phone = tables.Column(sTitle=u'手机', bSortable=False)
    email = tables.Column(sTitle=u'Email', bSortable=False)
    qq = tables.Column(sTitle=u'qq', bSortable=False)
    action= tables.Column(sTitle=u'操作', bSortable=False, accessor=tables.Table.CALLBACK)
    
    @classmethod
    def get_action(cls,room,user=None):
        actions = ['view']
        actions.append('edit')
        actions.append('delete')
        return ','.join(actions)
Exemple #6
0
class RoomTypeTable(tables.Table):
    id = tables.Column(sTitle=u'ID', bSortable=False)
    name = tables.Column(sTitle=u'名称', bSortable=False)
    status = tables.Column(sTitle=u'状态', bSortable=False)
    comment = tables.Column(sTitle=u'说明', bSortable=False)
    price = tables.Column(sTitle=u'价格', bSortable=False)
    action = tables.Column(sTitle=u'操作',
                           bSortable=False,
                           accessor=tables.Table.CALLBACK)

    @classmethod
    def get_action(cls, room_type, user=None):
        actions = ['view']
        actions.append('edit')
        actions.append('delete')
        actions.append('add')
        actions.append('order')
        return ','.join(actions)