Skip to main content

Simple Django form and model fields for working with stdnum fields.

Project description

CircleCI codecov Code style: black

version: 0.2.0

What's an stdnum?

See python-stdnum

Usage:

from stdnumfield.models import StdNumField


class SomeMode(models.Model):
    field = StdNumField(
        'hr.oib',  # stdnum format
    )


class SampleModelForm(ModelForm):
    class Meta:
        model = SomeModel
        fields = ('field',)
        error_messages = {
            'field': {
                'stdnum_format':_("Not maching format %(format_list)s"),  # you can override exception message
            },
        }

Local development and testing

There is a gazillion ways of managing Python versions these days. I prefer pip and pyenv:

pyenv install --skip-existing 3.7.4
pyenv install --skip-existing 3.6.9
pyenv install --skip-existing 3.5.7
pyenv install --skip-existing 2.7.16
pyenv virtualenv 3.7.4 django-stdnumfield
echo 'django-stdnumfield:2.7.16:3.6.9:3.5.7' > .python-version
pip install -e .[dev]

Run the test project with:

cd testproject
./manage.py migrate
./manage.py runserver

Then navigate to:

A valid number to test with: 12345678903

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-stdnumfield-0.2.0.tar.gz (8.9 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