def __init__(self, request, *args, **kwargs): super(BaseUserForm, self).__init__(*args, **kwargs) # Populate tenant choices tenant_choices = [('', "Select a tenant")] for tenant in api.tenant_list(request): if tenant.enabled: tenant_choices.append((tenant.id, tenant.name)) self.fields['tenant_id'].choices = tenant_choices
def __init__(self, request, *args, **kwargs): super(DownloadOpenRCForm, self).__init__(*args, **kwargs) # Populate tenant choices tenant_choices = [] for tenant in api.tenant_list(request): if tenant.enabled: tenant_choices.append((tenant.id, tenant.name)) self.fields["tenant"].choices = tenant_choices
def get_data(self): tenants = [] try: tenants = api.tenant_list(self.request) except api_exceptions.AuthorizationFailure, e: LOG.exception("Unauthorized attempt to list tenants.") messages.error(self.request, _('Unable to get tenant info: %s') % e.message)