Skip to main content

A Django form widget implementing intl-tel-input.

Project description

A Django form widget based on the jQuery plugin intl-tel-input.

This is a new package, so it doesn’t implement all the features of intl-tel-input. However, it has been stable in testing, so if you’re still down…

Installation

Install from PyPI.

pip install django-intl-tel-input

Add intl-tel-input to your INSTALLED_APPS, so Django can find the init script.

...
INSTALLED_APPS += ('intl_tel_input',)
...

Usage

Simply add IntlTelInputWidget to your form field.

from intl_tel_input.widgets import IntlTelInputWidget

class MyForm(forms.ModelForm):
    class Meta:
        model = MyModel
        fields = ['foo', 'bar']
        widgets = {
            'bar': IntlTelInputWidget()
        }
...

If you have included jQuery at the end of your document, then don’t forget to update the template when this widget appears with a {{ form.media.js }}. Put it in a block that allows it to come after jQuery.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-intl-tel-input-0.1.0.zip (7.4 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page