Exemplo n.º 1
0
    def load_data(self, request, filters):
        data = super(OrganizationsComplexFilter, self).load_data(request, filters)

        owner_organizations = [org.id for org in request.organizations]
        for org in data['items']:
            if org['id'] not in owner_organizations:
                continue
            org['switch'] = idm_utils.get_switch_url(org, check_switchable=False)
        
        return data 
Exemplo n.º 2
0
    def load_data(self, request, filters):
        data = super(OrganizationsComplexFilter,
                     self).load_data(request, filters)

        owner_organizations = [org.id for org in request.organizations]
        for org in data['items']:
            if org['id'] not in owner_organizations:
                continue
            org['switch'] = idm_utils.get_switch_url(org,
                                                     check_switchable=False)

        return data
Exemplo n.º 3
0
class OwnedOrganizationsTable(tables.DataTable):
    avatar = tables.Column(lambda obj: idm_utils.get_avatar(
        obj, 'img_medium', idm_utils.DEFAULT_ORG_MEDIUM_AVATAR))
    name = tables.Column('name', verbose_name=('Name'))
    description = tables.Column(lambda obj: getattr(obj, 'description', ''))
    switch = tables.Column(
        lambda obj: idm_utils.get_switch_url(obj, check_switchable=False))
    hide_panel = True
    pagination_url = 'fiware_complex_server_filters_organizations'
    empty_message = 'You are not owner of any organization.'
    filter_data = {
        'organization_role': getattr(local_settings, "KEYSTONE_OWNER_ROLE"),
    }

    class Meta:
        name = "owned_organizations"
        verbose_name = ("")
        row_class = idm_tables.OrganizationClickableRow
Exemplo n.º 4
0
class OrganizationsTable(tables.DataTable):
    avatar = tables.Column(lambda obj: idm_utils.get_avatar(
        obj, 'img_medium', idm_utils.DEFAULT_ORG_MEDIUM_AVATAR))
    name = tables.Column('name', verbose_name=('Name'))
    description = tables.Column(lambda obj: getattr(obj, 'description', ''))
    switch = tables.Column(lambda obj: idm_utils.get_switch_url(obj))
    view_all_url = 'horizon:idm:organizations:index'
    pagination_url = 'fiware_complex_server_filters_organizations'
    empty_message = 'You don\'t have any organizations.'
    filter_data = {}

    def __init__(self, *args, **kwargs):
        super(OrganizationsTable, self).__init__(*args, **kwargs)
        self.filter_data.update({'user_id': self.request.user.id})

    class Meta:
        name = "organizations"
        verbose_name = 'Organizations'
        table_actions = (CreateOrganization, )
        multi_select = False
        row_class = idm_tables.OrganizationClickableRow
        template = 'idm/home/_data_table.html'