Django model and form fields that performs URL normalization. For example it adds 'http://' prefix and forces punicode encoding.
Project description
Django model and form fields that performs URL normalization. For example it adds ‘http://’ prefix and forces punicode encoding. There are also fields that stores a list of URLs.
Tested with Django 1.9, 1.10 and 1.11.
Installing
$ pip install django-smarturlfield
Fields
SmartURLFormField renders as <input> and can handle values like this:
http://example.com
example.com (normalized to http://example.com)
земфира.рф (normalized to http://xn--80ajfftz0a.xn--p1ai)
MultipleSmartURLFormField renders as <textarea> and can store multiple URLs separated by newline.
Usage
In forms:
from smarturlfield import SmartURLFormField, MultipleSmartURLFormField
class MyForm(forms.Form):
url = SmartURLFormField()
url_list = MultipleSmartURLFormField() # textarea
# ...
In models:
from smarturlfield import SmartURLDbField, MultipleSmartURLDbField
class MyModel(models.Model):
url = SmartURLDbField()
url_list = MultipleSmartURLDbField() # textarea
# ...
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
Hashes for django-smarturlfield-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333b5fc66f01df75f67a222b9be4a001382481b3a68d9bbd726eb4dcfbe46451 |
|
MD5 | 93b348a038db393adabefb63ed2c27c8 |
|
BLAKE2b-256 | f76607416fd2e9a778fb17d936d130c21466e9076c971ac923bfa2fbe2fbb22c |