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


Python humanize.intcomma方法代码示例

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


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

示例1: shared_static_pages

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def shared_static_pages(request, page):
    from django.utils.module_loading import import_string
    from django.contrib.humanize.templatetags.humanize import intcomma
    password_hasher = import_string(settings.PASSWORD_HASHERS[0])()
    password_hash_method = password_hasher.algorithm.upper().replace("_", " ") \
        + " (" + intcomma(password_hasher.iterations) + " iterations)"

    return render(request,
        page + ".html", {
        "base_template": "base.html",
        "SITE_ROOT_URL": request.build_absolute_uri("/"),
        "password_hash_method": password_hash_method,
        # "project_form": ProjectForm(request.user),
        "project_form": None,
    })

# SINGLE SIGN ON 
开发者ID:GovReady,项目名称:govready-q,代码行数:19,代码来源:views.py

示例2: add_metadata

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def add_metadata(request, coin_symbol):
    block_hash = get_latest_block_hash(coin_symbol)

    block_overview = get_block_overview(
            block_representation=block_hash,
            coin_symbol=coin_symbol,
            txn_limit=500,
            api_key=BLOCKCYPHER_API_KEY,
            )

    random_tx_hash = choice(block_overview['txids'])

    redir_url = reverse(
            'add_metadata_to_tx',
            kwargs={'coin_symbol': coin_symbol, 'tx_hash': random_tx_hash},
            )

    msg = _('%(cs_display)s transaction %(tx_hash)s from latest block (%(latest_block_num)s) randomly selected' % {
        'cs_display': COIN_SYMBOL_MAPPINGS[coin_symbol]['currency_abbrev'],
        'tx_hash': random_tx_hash,
        'latest_block_num': intcomma(block_overview['height']),
        })

    messages.success(request, msg, extra_tags='safe')
    return HttpResponseRedirect(redir_url) 
开发者ID:blockcypher,项目名称:explorer,代码行数:27,代码来源:views.py

示例3: to_int_comma

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def to_int_comma(num):
    return intcomma(int(num)) 
开发者ID:gcallah,项目名称:indras_net,代码行数:4,代码来源:formatting.py

示例4: clean_amount

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def clean_amount(self):
        """Validate the provided amount of an asset."""
        amount = round(self.cleaned_data["amount"], self.decimal_places)
        if amount < self.min_amount:
            raise forms.ValidationError(
                _("The minimum amount is: %s")
                % intcomma(round(self.min_amount, self.decimal_places))
            )
        elif amount > self.max_amount:
            raise forms.ValidationError(
                _("The maximum amount is: %s")
                % intcomma(round(self.max_amount, self.decimal_places))
            )
        return amount 
开发者ID:stellar,项目名称:django-polaris,代码行数:16,代码来源:forms.py

示例5: format_score

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def format_score(value):
    if value is None:
        return "N/A"

    if isinstance(value, bool):
        return '\u2714' if value else '\u2718'

    elif isinstance(value, int):
        return intcomma(value)

    f = floatformat(value, 2)
    if f:
        return f

    return value 
开发者ID:chaoss,项目名称:prospector,代码行数:17,代码来源:metrics.py

示例6: get_display_value

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def get_display_value(self):
        """should return $100.00
        """
        value = self.get_current_value()
        if value is None:
            return ''
        return "${}.00".format(intcomma(value)) 
开发者ID:codeforamerica,项目名称:intake,代码行数:9,代码来源:field_types.py

示例7: format_currency

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def format_currency(self, dollars):
        """ Provides a cost estimate in formatted dollars """
        dollars = round(float(dollars), 2)
        return "$%s%s" % (intcomma(int(dollars)), ("%0.2f" % dollars)[-3:]) 
开发者ID:ekansa,项目名称:open-context-py,代码行数:6,代码来源:estimator.py

示例8: format_percentage

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def format_percentage(self, value):
        if value is None:
            formatted_percent = u'0'
        else:
            formatted_percent = intcomma(round(value, 3) * 100)

        return formatted_percent 
开发者ID:edx,项目名称:edx-analytics-dashboard,代码行数:9,代码来源:enrollment.py

示例9: format_tip_percent

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def format_tip_percent(self, value):
        if value is None:
            formatted_percent = u'0'
        else:
            formatted_percent = intcomma(round(value, 3) * 100)

        return formatted_percent 
开发者ID:edx,项目名称:edx-analytics-dashboard,代码行数:9,代码来源:__init__.py

示例10: join_stats

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def join_stats(d, status, sep=", "):
    joined = ""

    empty_extras = ""
    if status == Harvest.RUNNING:
        empty_extras = "Nothing yet"
    elif status == Harvest.REQUESTED:
        empty_extras = "Waiting for update"

    if d:
        for i, (item, count) in enumerate(d.items()):
            if i > 1:
                joined += sep
            joined += "{} {}".format(intcomma(count), item)
    return joined if joined else empty_extras 
开发者ID:gwu-libraries,项目名称:sfm-ui,代码行数:17,代码来源:ui_extras.py

示例11: render_fund_allocation

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def render_fund_allocation(self, record):
        return f'${intcomma(record.amount_paid)} / ${intcomma(record.value)}' 
开发者ID:OpenTechFund,项目名称:hypha,代码行数:4,代码来源:tables.py

示例12: get_context_data

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def get_context_data(self, **kwargs):
        submissions = ApplicationSubmission.objects.all()
        submission_undetermined_count = submissions.undetermined().count()
        review_my_count = submissions.reviewed_by(self.request.user).count()

        submission_value = submissions.current().value()
        submission_sum = intcomma(submission_value.get('value__sum'))
        submission_count = submission_value.get('value__count')

        submission_accepted_value = submissions.current_accepted().value()
        submission_accepted_sum = intcomma(submission_accepted_value.get('value__sum'))
        submission_accepted_count = submission_accepted_value.get('value__count')

        reviews = Review.objects.all()
        review_count = reviews.count()
        review_my_score = reviews.by_user(self.request.user).score()

        return super().get_context_data(
            submission_undetermined_count=submission_undetermined_count,
            review_my_count=review_my_count,
            submission_sum=submission_sum,
            submission_count=submission_count,
            submission_accepted_count=submission_accepted_count,
            submission_accepted_sum=submission_accepted_sum,
            review_count=review_count,
            review_my_score=review_my_score,
            **kwargs,
        ) 
开发者ID:OpenTechFund,项目名称:hypha,代码行数:30,代码来源:views.py

示例13: roundpound

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def roundpound(num):
    order = 10 ** math.floor(math.log10(num))
    if order > 0:
        return intcomma(int(round(num / order) * order))
    else:
        return str(int(round(num))) 
开发者ID:ebmdatalab,项目名称:openprescribing,代码行数:8,代码来源:template_extras.py

示例14: _humanize

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def _humanize(cost_saving):
    return intcomma(int(round(abs(cost_saving)))) 
开发者ID:ebmdatalab,项目名称:openprescribing,代码行数:4,代码来源:test_measures.py

示例15: testo_euro

# 需要导入模块: from django.contrib.humanize.templatetags import humanize [as 别名]
# 或者: from django.contrib.humanize.templatetags.humanize import intcomma [as 别名]
def testo_euro(numero, simbolo_html=False):
    euro = round(float(numero), 2)
    simbolo = "&euro;" if simbolo_html else "€"
    return ("%s%s %s" % (intcomma(int(euro)), ("%0.2f" % euro)[-3:], simbolo)).replace('.', ',') 
开发者ID:CroceRossaItaliana,项目名称:jorvik,代码行数:6,代码来源:utils.py


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