Beispiel #1
0
def country_list_with_all():
    """Country list"""
    list_ct = []
    list_ct.append((0, _('All')))
    ct_list = get_country_list()
    for i in ct_list:
        list_ct.append((i[0], i[1]))
    return list_ct
Beispiel #2
0
def country_list_with_all():
    """Country list"""
    list_ct = []
    list_ct.append((0, _('All')))
    ct_list = get_country_list()
    for i in ct_list:
        list_ct.append((i[0], i[1]))
    return list_ct
Beispiel #3
0
class BWCountryForm(forms.Form):
    """Blacklist/Whitelist by country form"""
    country = forms.ChoiceField(label=_('Country'), required=True,
                                choices=get_country_list())

    def __init__(self, *args, **kwargs):
        super(BWCountryForm, self).__init__(*args, **kwargs)
        self.fields.keyOrder = ['country']
Beispiel #4
0
def country_list_with_all():
    """
    Country list
    """
    list_ct = []
    list_ct.append((0, _('all').capitalize()))
    for i in get_country_list():
        list_ct.append((i[0], i[1]))
    return list_ct
Beispiel #5
0
def country_list_with_all():
    """
    Country list
    """
    list_ct = []
    list_ct.append((0, _('all').capitalize()))
    for i in get_country_list():
        list_ct.append((i[0], i[1]))
    return list_ct
Beispiel #6
0
    def __init__(self, form_type, *args, **kwargs):
        super(BWCountryForm, self).__init__(*args, **kwargs)
        self.fields['country'].choices = get_country_list()

        self.helper = FormHelper()
        if form_type == 'blacklist':
            self.helper.form_id = 'id_bl_country_from'
            form_button = HTML("""<input id="add_bl_country" type="button" class="btn btn-info" value="%s" />""" %
                               _("blacklist this country").capitalize())
        else:
            self.helper.form_id = 'id_wl_country_from'
            form_button = HTML("""<input id="add_wl_country" type="button" class="btn btn-info" value="%s" />""" %
                               _("whitelist this country").capitalize())

        self.helper.form_show_labels = False
        css_class = 'col-md-3 col-xs-6'
        self.helper.layout = Layout(
            Div(
                Div('country', css_class=css_class),
                Div(form_button, css_class=css_class),
                css_class='row',
            ),
        )
Beispiel #7
0
    def __init__(self, form_type, *args, **kwargs):
        super(BWCountryForm, self).__init__(*args, **kwargs)
        self.fields['country'].choices = get_country_list()

        self.helper = FormHelper()
        if form_type == 'blacklist':
            self.helper.form_id = 'id_bl_country_from'
            form_button = HTML(
                """<input id="add_bl_country" type="button" class="btn btn-info" value="%s" />"""
                % _("blacklist this country").capitalize())
        else:
            self.helper.form_id = 'id_wl_country_from'
            form_button = HTML(
                """<input id="add_wl_country" type="button" class="btn btn-info" value="%s" />"""
                % _("whitelist this country").capitalize())

        self.helper.form_show_labels = False
        css_class = 'col-md-3 col-xs-6'
        self.helper.layout = Layout(
            Div(
                Div('country', css_class=css_class),
                Div(form_button, css_class=css_class),
                css_class='row',
            ), )