当前位置: 首页>>代码示例>>Python>>正文


Python C3sMember.get_number方法代码示例

本文整理汇总了Python中c3smembership.data.model.base.c3smember.C3sMember.get_number方法的典型用法代码示例。如果您正苦于以下问题:Python C3sMember.get_number方法的具体用法?Python C3sMember.get_number怎么用?Python C3sMember.get_number使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在c3smembership.data.model.base.c3smember.C3sMember的用法示例。


在下文中一共展示了C3sMember.get_number方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: member_list_print_view

# 需要导入模块: from c3smembership.data.model.base.c3smember import C3sMember [as 别名]
# 或者: from c3smembership.data.model.base.c3smember.C3sMember import get_number [as 别名]
def member_list_print_view(request):
    """
    This view produces printable HTML output, i.e. HTML without links

    It was used before the PDF-generating view above existed
    """
    all_members = C3sMember.member_listing(
        'lastname', how_many=C3sMember.get_number(), offset=0, order=u'asc')
    member_list = []
    count = 0
    for member in all_members:
        if member.is_member():
            # check membership number
            try:
                assert(member.membership_number is not None)
            except AssertionError:
                if DEBUG:  # pragma: no cover
                    print u"failed at id {} lastname {}".format(
                        member.id, member.lastname)
            member_list.append(member)
            count += 1
    # sort members alphabetically
    import locale
    locale.setlocale(locale.LC_ALL, "de_DE.UTF-8")

    member_list.sort(key=lambda x: x.firstname, cmp=locale.strcoll)
    member_list.sort(key=lambda x: x.lastname, cmp=locale.strcoll)

    return {
        'members': member_list,
        'count': count,
        '_today': date.today(),
    }
开发者ID:C3S,项目名称:c3sMembership,代码行数:35,代码来源:membership_members_list.py

示例2: stats_view

# 需要导入模块: from c3smembership.data.model.base.c3smember import C3sMember [as 别名]
# 或者: from c3smembership.data.model.base.c3smember.C3sMember import get_number [as 别名]
def stats_view(request):
    """
    This view lets accountants view statistics:
    how many membership applications, real members, shares, etc.
    """
    # countries_dict = C3sMember.get_countries_list()
    _cl = C3sMember.get_countries_list()
    _cl_sorted = _cl.items()
    # print "die liste: {}".format(_cl_sorted)
    import operator
    _cl_sorted.sort(key=operator.itemgetter(1), reverse=True)
    # print "sortiert: {}".format(_cl_sorted)
    share_information = request.registry.share_information
    return {
        # form submissions
        '_number_of_datasets': C3sMember.get_number(),
        'afm_shares_unpaid': C3sMember.afm_num_shares_unpaid(),
        'afm_shares_paid': C3sMember.afm_num_shares_paid(),
        # shares
        'num_shares_members': share_information.get_share_count(),
        # 'num_shares_mem_norm': Shares.get_sum_norm(),
        # 'num_shares_mem_inv': Shares.get_sum_inv(),

        # memberships
        'num_members_accepted': C3sMember.get_num_members_accepted(),
        'num_non_accepted': C3sMember.get_num_non_accepted(),
        'num_nonmember_listing': C3sMember.nonmember_listing_count(),
        'num_duplicates': len(C3sMember.get_duplicates()),
        # 'num_empty_slots': C3sMember.get_num_empty_slots(),
        # normal persons vs. legal entities
        'num_ms_nat_acc': C3sMember.get_num_mem_nat_acc(),
        'num_ms_jur_acc': C3sMember.get_num_mem_jur_acc(),
        # normal vs. investing memberships
        'num_ms_norm': C3sMember.get_num_mem_norm(),
        'num_ms_inves': C3sMember.get_num_mem_invest(),
        'num_ms_features': C3sMember.get_num_mem_other_features(),
        'num_membership_lost': C3sMember.get_num_membership_lost(),
        # membership_numbers
        'num_memnums': C3sMember.get_num_membership_numbers(),
        'max_memnum': C3sMember.get_highest_membership_number(),
        'next_memnum': C3sMember.get_next_free_membership_number(),

        # countries
        'num_countries': C3sMember.get_num_countries(),
        'countries_list': _cl_sorted,

        # dues stats
        'dues15_stats': DuesInvoiceRepository.get_monthly_stats(2015),
        'dues16_stats': DuesInvoiceRepository.get_monthly_stats(2016),
        'dues17_stats': DuesInvoiceRepository.get_monthly_stats(2017),
        'dues18_stats': DuesInvoiceRepository.get_monthly_stats(2018),
        'dues19_stats': DuesInvoiceRepository.get_monthly_stats(2019),

        # staff figures
        'num_staff': len(Staff.get_all())
    }
开发者ID:C3S,项目名称:c3sMembership,代码行数:58,代码来源:statistics.py

示例3: test_add_member

# 需要导入模块: from c3smembership.data.model.base.c3smember import C3sMember [as 别名]
# 或者: from c3smembership.data.model.base.c3smember.C3sMember import get_number [as 别名]
    def test_add_member(self):
        '''
        tests for the new_member view
        '''
        # unauthorized access must be prevented
        res = self.testapp.reset()  # delete cookie
        res = self.testapp.get('/new_member', status=403)
        assert('Access was denied to this resource' in res.body)

        # so login first
        self._login()

        # no member with id=1 in DB
        res = self.testapp.get('/new_member?id=1', status=200)
        # enter valid data
        form = self._fill_form_valid_natural(res.form)
        res = form.submit(u'submit', status=302)
        res4 = res.follow()

        self.assertTrue('Membership application details' in res4.body)
        self.assertTrue('SomeFirstname' in res4.body)
        self.assertTrue('SomeLastname' in res4.body)
        self.assertTrue('[email protected]' in res4.body)
        self.assertTrue('addr one' in res4.body)
        self.assertTrue('addr two' in res4.body)
        self.assertTrue('12345' in res4.body)
        self.assertTrue('DE' in res4.body)
        self.assertTrue('normal' in res4.body)
        self.assertTrue('23' in res4.body)

        # now, there is a member with id=1 in DB
        res = self.testapp.get('/new_member?id=1', status=200)

        # check the number of entries in the DB
        self.assertEqual(C3sMember.get_number(), 1)


        res = self.testapp.get('/new_member', status=200)
        form = self._fill_form_valid_legal(res.form)
        res = form.submit(u'submit', status=302)
        res4 = res.follow()

        self.assertTrue('Membership application details' in res4.body)
        self.assertTrue('SomeLegalentity' in res4.body)
        self.assertTrue('SomeLegalName' in res4.body)
        self.assertTrue('[email protected]' in res4.body)
        self.assertTrue('addr one' in res4.body)
        self.assertTrue('addr two' in res4.body)
        self.assertTrue('12345' in res4.body)
        self.assertTrue('' in res4.body)
        self.assertTrue('DE' in res4.body)
        self.assertTrue('investing' in res4.body)
        self.assertTrue('42' in res4.body)
开发者ID:C3S,项目名称:c3sMembership,代码行数:55,代码来源:test_new_member_webtest.py


注:本文中的c3smembership.data.model.base.c3smember.C3sMember.get_number方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。