Some useful database field definitions for Django.
Project description
# django-useful-fields
I found myself copying a few Django database field classes from project to project so I decided to bundle them together and release them as an open source package instead. Here are the fields that are currently included:
TimeZoneField
This field stores a reference to a time zone in the database and automatically instantiates the correct pytz time zone object on retrieval. Useful for recording a user’s default time zone.
MarkdownCharField
This field is meant to be used in collaboration with a regular CharField. The regular CharField stores the Markdown- formatted source text and this field will store the rendered HTML version of that same text. Use the populate_from argument to indicated which field on the same model contains the source text. If the allow_html argument is False (the default), any HTML tags present in the source text will be removed using the [bleach library](https://github.com/mozilla/bleach). The extensions argument can be used to enable any desired [extensions](https://pythonhosted.org/Markdown/extensions/index.html) for the [Markdown library](https://pythonhosted.org/Markdown/). One extension is enabled by default: [SmartyPants](https://pythonhosted.org/Markdown/extensions/smarty.html). SmartyPants is configured to use the correct Unicode characters (e.g. “) rather than HTML entities (e.g. “). Since CharFields don’t normally contain paragraphs of text, MarkdownCharField strips the <p></p> tags that Markdown always includes.
MarkdownTextField
This field is meant to be used in collaboration with a regular TextField. The regular TextField stores the Markdown- formatted source text and this field will store the rendered HTML version of that same text. Use the populate_from argument to indicated which field on the same model contains the source text. If the allow_html argument is False (the default), any HTML tags present in the source text will be removed using the [bleach library](https://github.com/mozilla/bleach). The extensions argument can be used to enable any desired [extensions](https://pythonhosted.org/Markdown/extensions/index.html) for the [Markdown library](https://pythonhosted.org/Markdown/). One extension is enabled by default: [SmartyPants](https://pythonhosted.org/Markdown/extensions/smarty.html). SmartyPants is configured to use the correct Unicode characters (e.g. “) rather than HTML entities (e.g. “).
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-useful-fields-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 073575fdaf8d2f687dc5e431a8c6a7f9603fd756a130df5ea4a431ad0923ff34 |
|
MD5 | c573fc30d6be08fe579b71e3b1e66f84 |
|
BLAKE2b-256 | cd047c6591297b8686c77751f7bed0ea0e631b0816357c2c2595f1a4a19463ea |
Hashes for django_useful_fields-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 431fc1d76a282abd6e5348fc46bbebabfb2694904019419af55e7d4890108e3a |
|
MD5 | 302d5e50b5f51a4821de98f60b150baa |
|
BLAKE2b-256 | a5fdf22ae1399e42146f2c82e0a8e659736bf3019711cab87a922c56813f1e9f |