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.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a77a2c903c418fd8f4e21396f255ee9ca50ac64676c124fae3863ba7a7f9b9a |
|
MD5 | 13c1d1f7eb80dcb13729e68d0e505a8b |
|
BLAKE2b-256 | b03042072dcea8a3cfbac69aa3eaef4f00f31460bfed74f8c8767441eed305b4 |
Hashes for django_smarturlfield-1.0.4-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e86764529e5e864d0a658394a3f718954822fc7c101aa3d1f1d1ca55b8b4a58f |
|
MD5 | 634e2b522fcb1c0491889693de061db9 |
|
BLAKE2b-256 | 18d07402bc3d7590b741f2eb82830f36b5f54dfd8220278529857fef8db14b58 |