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
Built Distribution
Hashes for django-smarturlfield-1.0.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c6a713d02262165c99af976c491a22c5cdd3a9bd2623d2d8a67aceea6903463 |
|
MD5 | 40eb3dd8f6f9d16351e4bfee000161d5 |
|
BLAKE2b-256 | 01a3e42a9723a147d252c2170c02bf18b9671051a3ec994dd3723b68c068ee49 |
Hashes for django_smarturlfield-1.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4931a76e58aec2a7cb56abdde4956a184e2b082c9487dca07eae0df686b4c0d8 |
|
MD5 | 5a1da4d7785f055e6a1f3977614b92d4 |
|
BLAKE2b-256 | 5ce4e3323423f27814e85d9eb722b88cf38b2e4c010156d27f8bf90035aa3cb0 |