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


Python C3sMember.get_next_free_membership_number方法代码示例

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


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

示例1: stats_view

# 需要导入模块: from c3smembership.models import C3sMember [as 别名]
# 或者: from c3smembership.models.C3sMember import get_next_free_membership_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)
    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': C3sMember.get_total_shares(),
        'num_shares_members': Shares.get_total_shares(),
        # '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(),
        # 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,
        #    key=lambda x: x[1]
        # ),  # XXX TODO: sorte

        # dues stats
        'dues15_stats': Dues15Invoice.get_monthly_stats(),
        'dues16_stats': Dues16Invoice.get_monthly_stats(),

        # staff figures
        'num_staff': len(C3sStaff.get_all())
    }
开发者ID:,项目名称:,代码行数:56,代码来源:

示例2: make_member_view

# 需要导入模块: from c3smembership.models import C3sMember [as 别名]
# 或者: from c3smembership.models.C3sMember import get_next_free_membership_number [as 别名]
def make_member_view(request):
    """
    Turns a membership applicant into an accepted member.

    When both the signature and the payment for the shares have arrived at
    headquarters, an application for membership can be turned into an
    **accepted membership**, if the board of directors decides so.

    This view lets staff enter a date of approval through a form.

    It also provides staff with listings of

    * members with same first name
    * members with same last name
    * members with same email address
    * members with same date of birth

    so staff can decide if this may become a proper membership
    or whether this application is a duplicate of some accepted membership
    and should be merged with some other entry.

    In case of duplicate/merge, also check if the number of shares
    when combining both entries would exceed 60,
    the maximum number of shares a member can hold.
    """
    _id = request.matchdict['afm_id']
    try:  # does that id make sense? member exists?
        member = C3sMember.get_by_id(_id)
        assert(isinstance(member, C3sMember))  # is an application
        # assert(isinstance(member.membership_number, NoneType)
        # not has number
    except AssertionError:
        return HTTPFound(
            location=request.route_url('dashboard'))
    if member.membership_accepted:
        # request.session.flash('id {} is already accepted member!')
        return HTTPFound(request.route_url('detail', memberid=member.id))

    if not (member.signature_received and member.payment_received):
        request.session.flash('signature or payment missing!', 'messages')
        return HTTPFound(request.route_url('dashboard'))

    if 'make_member' in request.POST:
        # print "yes! contents: {}".format(request.POST['make_member'])
        try:
            member.membership_date = datetime.strptime(
                request.POST['membership_date'], '%Y-%m-%d').date()
        except ValueError, value_error:
            request.session.flash(value_error.message, 'merge_message')
            return HTTPFound(
                request.route_url('make_member', afm_id=member.id))

        member.membership_accepted = True
        if member.is_legalentity:
            member.membership_type = u'investing'
        else:
            member.is_legalentity = False
        member.membership_number = C3sMember.get_next_free_membership_number()
        shares = Shares(
            number=member.num_shares,
            date_of_acquisition=member.membership_date,
            reference_code=member.email_confirm_code,
            signature_received=member.signature_received,
            signature_received_date=member.signature_received_date,
            payment_received=member.payment_received,
            payment_received_date=member.payment_received_date
        )
        DBSession.add(shares)
        member.shares = [shares]
        # return the user to the page she came from
        if 'referrer' in request.POST:
            if request.POST['referrer'] == 'dashboard':
                return HTTPFound(request.route_url('dashboard'))
            if request.POST['referrer'] == 'detail':
                return HTTPFound(
                    request.route_url('detail', memberid=member.id))
        return HTTPFound(request.route_url('detail', memberid=member.id))
开发者ID:,项目名称:,代码行数:79,代码来源:

示例3: HTTPFound

# 需要导入模块: from c3smembership.models import C3sMember [as 别名]
# 或者: from c3smembership.models.C3sMember import get_next_free_membership_number [as 别名]
            payment_received_date=member.payment_received_date
        )
        DBSession.add(shares)
        member.shares = [shares]
        # return the user to the page she came from
        if 'referrer' in request.POST:
            if request.POST['referrer'] == 'dashboard':
                return HTTPFound(request.route_url('dashboard'))
            if request.POST['referrer'] == 'detail':
                return HTTPFound(
                    request.route_url('detail', memberid=member.id))
        return HTTPFound(request.route_url('detail', memberid=member.id))

    referrer = ''
    if 'dashboard' in request.referrer:
        referrer = 'dashboard'
    if 'detail' in request.referrer:
        referrer = 'detail'
    return {
        'member': member,
        'next_mship_number': C3sMember.get_next_free_membership_number(),
        'same_mships_firstn': C3sMember.get_same_firstnames(member.firstname),
        'same_mships_lastn': C3sMember.get_same_lastnames(member.lastname),
        'same_mships_email': C3sMember.get_same_email(member.email),
        'same_mships_dob': C3sMember.get_same_date_of_birth(
            member.date_of_birth),
        # keep information about the page the user came from in order to
        # return her to this page
        'referrer': referrer,
    }
开发者ID:,项目名称:,代码行数:32,代码来源:

示例4: edit_member

# 需要导入模块: from c3smembership.models import C3sMember [as 别名]
# 或者: from c3smembership.models.C3sMember import get_next_free_membership_number [as 别名]

#.........这里部分代码省略.........
                'membership_date',
                appstruct['membership_meta']['membership_date']
            ),
            ('is_duplicate', appstruct['membership_meta']['is_duplicate']),
            (
                'is_duplicate_of',
                appstruct['membership_meta']['is_duplicate_of']
            ),
            (
                'accountant_comment',
                appstruct['membership_meta']['accountant_comment']
            ),
            (
                'membership_type',
                appstruct['membership_info']['membership_type']
            ),
            (
                'is_legalentity',
                1 if (appstruct['membership_info']['entity_type'] ==
                      'legalentity')
                else 0
            ),
            (
                'name_of_colsoc',
                appstruct['membership_info']['name_of_colsoc']
            ),
            ('num_shares', appstruct['shares']['num_shares']),
            (
                'signature_received',
                appstruct['membership_meta']['signature_received']
            ),
            (
                'signature_received_date',
                appstruct['membership_meta']['signature_received_date']
            ),
            (
                'payment_received',
                appstruct['membership_meta']['payment_received']
            ),
            (
                'payment_received_date',
                appstruct['membership_meta']['payment_received_date']
            ),
            (
                'membership_loss_type',
                appstruct['membership_meta'].get('membership_loss_type', None)
            ),
            (
                'membership_loss_date',
                appstruct['membership_meta'].get('membership_loss_date', None)
            ),
        ]

        for thing in listing:
            attribute_name = thing[0]
            attribute_value = thing[1]

            if member.__getattribute__(attribute_name) == attribute_value:
                pass
            else:
                LOG.info(
                    u'{0} changes {1} of id {2} to {3}'.format(
                        authenticated_userid(request),
                        attribute_name,
                        member.id,
                        attribute_value
                    )
                )
                setattr(member, attribute_name, attribute_value)

        # membership acceptance status can be set or unset.
        if appstruct['membership_meta'][
                'membership_accepted'] == member.membership_accepted:
            pass
        else:
            member.membership_accepted = appstruct[
                'membership_meta']['membership_accepted']
            if isinstance(member.membership_number, NoneType) \
                    and member.membership_accepted:
                member.membership_number = \
                    C3sMember.get_next_free_membership_number()

        if appstruct['membership_info']['entity_type'] == 'legalentity':
            member.is_legalentity = True
        else:
            member.is_legalentity = False

        # empty the messages queue (as validation worked anyways)
        deleted_msg = request.session.pop_flash()
        del deleted_msg
        return HTTPFound(  # redirect to details page
            location=request.route_url(
                'detail',
                memberid=member.id),
        )

    form.set_appstruct(appstruct)
    html = form.render()

    return {'form': html}
开发者ID:,项目名称:,代码行数:104,代码来源:


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