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


Python COUNTRIES.get方法代码示例

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


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

示例1: check_ioc_countries

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
def check_ioc_countries():
    """
    Check if all IOC codes map to ISO codes correctly
    """
    from django_countries.data import COUNTRIES

    print("Checking if all IOC codes map correctly")
    for key in ISO_TO_IOC:
        assert COUNTRIES.get(key), 'No ISO code for %s' % key
    print("Finished checking IOC codes")
开发者ID:DjangoAdminHackers,项目名称:django-countries,代码行数:12,代码来源:ioc_data.py

示例2: check_ioc_countries

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
def check_ioc_countries(verbosity=1):
    """
    Check if all IOC codes map to ISO codes correctly
    """
    from django_countries.data import COUNTRIES

    if verbosity:  # pragma: no cover
        print("Checking if all IOC codes map correctly")
    for key in ISO_TO_IOC:
        assert COUNTRIES.get(key), "No ISO code for %s" % key
    if verbosity:  # pragma: no cover
        print("Finished checking IOC codes")
开发者ID:SmileyChris,项目名称:django-countries,代码行数:14,代码来源:ioc_data.py

示例3: __init__

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
    def __init__(self, account, domain, creating_user, data=None, *args, **kwargs):
        super(ConfirmExtraUserChargesForm, self).__init__(account, domain, creating_user, data=data, *args, **kwargs)
        self.fields["confirm_product_agreement"].label = _(
            'I have read and agree to the <a href="%(pa_url)s" target="_blank">'
            "Software Product Subscription Agreement</a>."
        ) % {"pa_url": reverse("product_agreement")}

        from corehq.apps.users.views.mobile import MobileWorkerListView

        self.helper.layout = crispy.Layout(
            crispy.Fieldset(
                _("Basic Information"),
                "company_name",
                "first_name",
                "last_name",
                crispy.Field("emails", css_class="input-xxlarge"),
                "phone_number",
            ),
            crispy.Fieldset(
                _("Mailing Address"),
                "first_line",
                "second_line",
                "city",
                "state_province_region",
                "postal_code",
                crispy.Field(
                    "country", css_class="input-large", data_countryname=COUNTRIES.get(self.current_country, "")
                ),
            ),
            crispy.Field("confirm_product_agreement"),
            FormActions(
                crispy.HTML(
                    '<a href="%(user_list_url)s" class="btn">%(text)s</a>'
                    % {
                        "user_list_url": reverse(MobileWorkerListView.urlname, args=[self.domain]),
                        "text": _("Back to Mobile Workers List"),
                    }
                ),
                StrictButton(
                    _("Confirm Billing Information"),
                    type="submit",
                    css_class="btn btn-primary disabled",
                    disabled="disabled",
                    css_id="submit-button-pa",
                ),
                crispy.HTML(
                    '<p class="help-inline" id="submit-button-help-qa" style="vertical-align: '
                    'top; margin-top: 5px; margin-bottom: 0px;">%s</p>'
                    % _("Please agree to the Product Subscription " "Agreement above before continuing.")
                ),
            ),
        )
开发者ID:bazuzi,项目名称:commcare-hq,代码行数:54,代码来源:forms.py

示例4: update_mozillian_profiles

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
def update_mozillian_profiles(queryset=None):
    """Sync MozillianProfile objects with mozillians.org"""

    if not queryset:
        queryset = MozillianProfile.objects.all()

    for mozillian in queryset:
        data = get_mozillian_by_email(mozillian.email)

        if not data:
            # Try to fetch by username
            data = get_mozillian_by_username(mozillian.mozillian_username)

            if not data:
                continue

        if 'country' in data:
            mozillian.country = COUNTRIES.get(data['country'].upper(), '').capitalize()
        if 'full_name' in data:
            mozillian.full_name = data['full_name']
        else:
            mozillian.full_name = 'Private Mozillian'
        mozillian.email = data['email']
        if 'city' in data:
            mozillian.city = data['city']
        if 'ircname' in data:
            mozillian.ircname = data['ircname']
        if 'photo' in data:
            mozillian.avatar_url = data['photo']
        if 'bio' in data:
            mozillian.bio = data['bio']
        mozillian.save()

        mozillian.tracking_groups.clear()
        groups = []
        if 'groups' in data:
            for group in data['groups']:
                obj, created = MozillianGroup.objects.get_or_create(name=group)
                groups.append(obj)

        mozillian.tracking_groups = groups
        logger.debug('Mozillian succesfully updated.')
开发者ID:akatsoulas,项目名称:woodstock,代码行数:44,代码来源:utils.py

示例5: __init__

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
    def __init__(self, account, domain, creating_user, data=None, *args, **kwargs):
        super(ConfirmExtraUserChargesForm, self).__init__(account, domain, creating_user, data=data, *args, **kwargs)

        from corehq.apps.users.views.mobile import MobileWorkerListView
        self.helper.label_class = 'col-sm-3 col-md-2'
        self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'
        self.helper.layout = crispy.Layout(
            crispy.Fieldset(
                _("Basic Information"),
                'company_name',
                'first_name',
                'last_name',
                crispy.Field('email_list', css_class='input-xxlarge accounting-email-select2',
                             data_initial=json.dumps(self.initial.get('email_list'))),
                'phone_number',
            ),
            crispy.Fieldset(
                 _("Mailing Address"),
                'first_line',
                'second_line',
                'city',
                'state_province_region',
                'postal_code',
                crispy.Field('country', css_class="input-large accounting-country-select2",
                             data_country_code=self.current_country or '',
                             data_country_name=COUNTRIES.get(self.current_country, '')),
            ),
            hqcrispy.FormActions(
                crispy.HTML(
                    '<a href="%(user_list_url)s" class="btn btn-default">%(text)s</a>' % {
                        'user_list_url': reverse(MobileWorkerListView.urlname, args=[self.domain]),
                        'text': _("Back to Mobile Workers List")
                    }
                ),
                StrictButton(
                    _("Confirm Billing Information"),
                    type="submit",
                    css_class='btn btn-primary disabled',
                ),
            ),
        )
开发者ID:dimagi,项目名称:commcare-hq,代码行数:43,代码来源:forms.py

示例6: _get_country

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
def _get_country(domain):
    project = Domain.get_by_name(domain)
    if project and project.deployment.countries:
        return unicode(COUNTRIES.get(project.deployment.countries[0], ''))
开发者ID:bazuzi,项目名称:commcare-hq,代码行数:6,代码来源:run_form_websocket_feed.py

示例7: country_name_from_isd_code_or_empty

# 需要导入模块: from django_countries.data import COUNTRIES [as 别名]
# 或者: from django_countries.data.COUNTRIES import get [as 别名]
def country_name_from_isd_code_or_empty(isd_code):
    cc = COUNTRY_CODE_TO_REGION_CODE.get(isd_code)
    return force_unicode(COUNTRIES.get(cc[0])) if cc else ''
开发者ID:ansarbek,项目名称:commcare-hq,代码行数:5,代码来源:utils.py


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