Пример #1
0
 def get_data(self):
     table = self.get_table()
     # urbane = UrbaneClient(
     #     auth_url=ADMIN_AUTH_URL,
     #     username=ADMIN_USERNAME,
     #     password=ADMIN_PASSWORD,
     #     # urbane client automatically discovers
     #     # Keystone API version from auth_url
     #     # and takes required parameter
     #     tenant=ADMIN_TENANT,
     #     domain=ADMIN_DOMAIN,
     #     region=ADMIN_REGION
     # )
     urbane = get_urbaneclient()
     table._page_ = int(
         self.request.GET.get(
             signups_tables.SignupsTable._meta.pagination_param, 1))
     if table._page_ < 1:
         table._page_ = 1
     page_size = utils.get_page_size(self.request)
     page_range = '%d:%d' % (table._page_, page_size)
     signups, total = urbane.list(range=page_range)
     # handle _has_more_data_
     self._has_more_data_ = (total // page_size) + 1 > table._page_
     return signups
Пример #2
0
    def get_context_data(self, **kwargs):
        context = super(DetailView, self).get_context_data(**kwargs)

        #Connecting to urbaneclient to fetch the details of an individual signup
        urbane = get_urbaneclient()
        signup = urbane.get(id=kwargs['signup_id'])
        context['signup'] = signup.as_dict()
        context['signup']['extra_as_str'] = json.dumps(signup.extra,
                                                       sort_keys=True,
                                                       indent=4)
        context['contact_extra_label'] = SIGNUP_CONTACT_EXTRA_LABEL
        return context
Пример #3
0
def urbane():
    global _urbane_
    if not _urbane_:
        # _urbane_ = UrbaneClient(
        #     auth_url=ADMIN_AUTH_URL,
        #     username=ADMIN_USERNAME,
        #     password=ADMIN_PASSWORD,
        #     # urbane client automatically discovers
        #     # Keystone API version from auth_url
        #     # and takes required parameter
        #     tenant=ADMIN_TENANT,
        #     domain=ADMIN_DOMAIN,
        #     region=ADMIN_REGION
        # )
        _urbane = get_urbaneclient()
    return _urbane_
Пример #4
0
    def get_data(self):
        table = self.get_table()

        #Connecting to urbaneclient for listing the signups
        urbane = get_urbaneclient()
        table._page_ = int(
            self.request.GET.get(
                signups_tables.SignupsTable._meta.pagination_param, 1))
        if table._page_ < 1:
            table._page_ = 1
        page_size = utils.get_page_size(self.request)
        page_range = '%d:%d' % (table._page_, page_size)
        signups, total = urbane.list(range=page_range)

        # handle _has_more_data_
        self._has_more_data_ = (total // page_size) + 1 > table._page_
        return signups
Пример #5
0
 def get_context_data(self, **kwargs):
     context = super(DetailView, self).get_context_data(**kwargs)
     # urbane = UrbaneClient(
     #     auth_url=ADMIN_AUTH_URL,
     #     username=ADMIN_USERNAME,
     #     password=ADMIN_PASSWORD,
     #     # urbane client automatically discovers
     #     # Keystone API version from auth_url
     #     # and takes required parameter
     #     tenant=ADMIN_TENANT,
     #     domain=ADMIN_DOMAIN,
     #     region=ADMIN_REGION
     # )
     urbane = get_urbaneclient()
     signup = urbane.get(id=kwargs['signup_id'])
     context['signup'] = signup.as_dict()
     context['signup']['extra_as_str'] = json.dumps(signup.extra,
                                                    sort_keys=True,
                                                    indent=4)
     context['contact_extra_label'] = SIGNUP_CONTACT_EXTRA_LABEL
     return context
Пример #6
0
 def delete(self, request, id):
     uclient = get_urbaneclient()
     uclient.delete(id)
Пример #7
0
 def action(self, request, id):
     uclient = get_urbaneclient()
     uclient.action(id, 'reject')