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.11 and 2.1.
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.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95d78f4682d5076faa128e991c86e5b15d18fb90207e98a12dd84df1f860d706 |
|
MD5 | f708c76459ad4c60ec006883f25cd923 |
|
BLAKE2b-256 | b30d5fa87787d11f0b8dde3ebb9ca6e25ad5e3a7e04710800161b68896217af2 |