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.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ada2c55d0b74c1de40e19cc9f07df8126b2dd3d9a94a29a10f5158dae1c55afd |
|
MD5 | 09aef5fa20461d55fdf9f5520defc502 |
|
BLAKE2b-256 | 1a5616b9d9a03c94650cc7b3afe6df0b87b16231a63eeff60af6fd78f68a0dde |