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.
``“``).
- **UUIDPrimaryKeyField**
| UUIDs are, in many ways, better primary keys than automatically
incrementing integer fields. Unfortunately, the
| default Django implementation—\ ``UUIDField``—requires some
boilerplate (including importing the ``uuid`` module) before
| it can be used as a primary key. UUIDPrimaryKeyField manages the
boilerplate for you. Just add
::
id = UUIDPrimaryKeyField()
to your model and everything will just work.
====================
| 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.
``“``).
- **UUIDPrimaryKeyField**
| UUIDs are, in many ways, better primary keys than automatically
incrementing integer fields. Unfortunately, the
| default Django implementation—\ ``UUIDField``—requires some
boilerplate (including importing the ``uuid`` module) before
| it can be used as a primary key. UUIDPrimaryKeyField manages the
boilerplate for you. Just add
::
id = UUIDPrimaryKeyField()
to your model and everything will just work.
Release files for django-useful-fields 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-useful-fields-0.0.2.tar.gz | 3.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_useful_fields-0.0.2-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 10.0 kB
Release files / django-useful-fields-0.0.2.tar.gz
| Download URL | django-useful-fields-0.0.2.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9f6628faad0cdd9db0c855344976d5350cc4cd64a1ced482e02f85542b63fa88
|
|
BLAKE2b-256 checksum How to use checksums |
a68cb5e410d8dc4bc41f958bad0928b7a563c10f9ebafa7ad4f0a475af893a34
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_useful_fields-0.0.2-py2.py3-none-any.whl
| Download URL | django_useful_fields-0.0.2-py2.py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
2a8a0189eca367ef390c44fa397a928502f514230a7b727f1eb38b7a0817d816
|
|
BLAKE2b-256 checksum How to use checksums |
068403567235ce02ebd79cf4f119211860590f9bd5d0f2f74809341deb9b9d65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |