コード例 #1
0
def memberpage_primary(sender, **kwargs):
    request = sender
    if request.resolver_match and request.resolver_match.view_name.startswith(
            "public:memberpage"):
        secret_token = request.resolver_match.kwargs.get('secret_token')
        if secret_token:
            kwargs = {'secret_token': secret_token}
            config = Configuration.get_solo()
            result = [{
                'label':
                _('Member page'),
                'url':
                reverse('public:memberpage:member.dashboard', kwargs=kwargs),
                'active':
                request.resolver_match.view_name ==
                'public:memberpage.dashboard',
            }]
            if config.can_see_other_members in (
                    MemberViewLevel.NAME_ONLY,
                    MemberViewLevel.NAME_AND_CONTACT,
            ):
                member = Member.all_objects.filter(
                    profile_memberpage__secret_token=secret_token).first()
                if member.is_active:
                    result.append({
                        'label':
                        _('Member list'),
                        'url':
                        reverse('public:memberpage:member.list',
                                kwargs=kwargs),
                        'active':
                        request.resolver_match.view_name ==
                        'public:memberpage:member.list',
                    })
            return result
    return {}
コード例 #2
0
 def get_form_kwargs(self):
     form_kwargs = super().get_form_kwargs()
     form_kwargs["instance"] = Configuration.get_solo()
     return form_kwargs
コード例 #3
0
ファイル: models.py プロジェクト: pc-coholic/byro
 def statute_barred_debt(self, future_limit=relativedelta()) -> Decimal:
     limit = relativedelta(months=Configuration.get_solo().liability_interval) - future_limit
     last_unenforceable_date = now().replace(month=12, day=31) - limit - relativedelta(years=1)
     return max(Decimal('0.00'), -self._calc_balance(last_unenforceable_date))