def get_data(self): filters = self.get_filters() prev_marker = self.request.GET.get( ProfilesTable._meta.prev_pagination_param, None) if prev_marker is not None: marker = prev_marker else: marker = self.request.GET.get( ProfilesTable._meta.pagination_param, None) reversed_order = prev_marker is not None try: profiles, self._more, self._prev = senlin.profile_list( self.request, marker=marker, paginate=True, reversed_order=reversed_order, filters=filters) except Exception: self._prev = self._more = False profiles = [] msg = _('Unable to retrieve profiles.') exceptions.handle(self.request, msg) return profiles
def get_data(self): try: params = {} profiles = senlin.profile_list(self.request, params) except Exception: profiles = [] msg = _('Unable to retrieve profiles.') exceptions.handle(self.request, msg) return profiles
def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) profiles = senlin.profile_list(request, params={}) self.fields['profile_id'].choices = ( [("", _("Select Profile"))] + [(profile.id, profile.name) for profile in profiles]) clusters = senlin.cluster_list(request, params={}) self.fields['cluster_id'].choices = ( [("", _("Select Cluster"))] + [(cluster.id, cluster.name) for cluster in clusters])
def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) profiles = senlin.profile_list(request)[0] self.fields['profile_id'].choices = ( [("", _("Select Profile"))] + [(profile.id, profile.name) for profile in profiles]) clusters = senlin.cluster_list(request)[0] self.fields['cluster_id'].choices = ( [("", _("Select Cluster"))] + [(cluster.id, cluster.name) for cluster in clusters])
def get(self, request): """Get a list of profiles.""" filters, kwargs = rest_utils.parse_filters_kwargs(request, CLIENT_KEYWORDS) profiles, has_more_data, has_prev_data = senlin.profile_list( request, filters=filters, **kwargs) return { 'items': [p.to_dict() for p in profiles], 'has_more_data': has_more_data, 'has_prev_data': has_prev_data, }
def get(self, request): """Get a list of profiles.""" filters, kwargs = rest_utils.parse_filters_kwargs( request, CLIENT_KEYWORDS) profiles, has_more_data, has_prev_data = senlin.profile_list( request, filters=filters, **kwargs) return { 'items': [p.to_dict() for p in profiles], 'has_more_data': has_more_data, 'has_prev_data': has_prev_data, }
def __init__(self, request, *args, **kwargs): super(CreateForm, self).__init__(request, *args, **kwargs) profiles = senlin.profile_list(request)[0] self.fields["profile_id"].choices = [("", _("Select Profile"))] + [ (profile.id, profile.name) for profile in profiles ]
def __init__(self, request, *args, **kwargs): super(UpdateNodeForm, self).__init__(request, *args, **kwargs) profiles = senlin.profile_list(request)[0] self.fields['profile_id'].choices = ( [("", _("Select Profile"))] + [(profile.id, profile.name) for profile in profiles])