CachedMarkdownField for Django Models
This Field caches compiled Markdown and then uses the cached value when queried. This saves time spent compiling Markdown on every request.
Example
class NameAndDescription(models.Model):
name = CharField(max_length=20)
description = CachedMarkdownField()
instance = NameAndDescription()
instance.description = "text"
assert instance.description == "<p>text</p>"
Settings
CachedMarkdownField recongnized two SETTINGS.py settings
# Enables caching
MARKDOWN_CACHE = True
# If false, will raise error if not already compiled
MARKDOWN_CACHE_RUNTIME = True
How does it work?
Internally CachedMarkdownField uses CompositeField and stores the cached value in separate field. CachedMarkdownField is a proxy and will add two fields into the actual model. In the example
above instance.description returns a proxy object that maps the fields markdown and cached
to the model fields description_markdown and description_cached.
Metadata
Release files for cached-markdown-field 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| cached_markdown_field-0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for cached_markdown_field-0.1-py2.py3-none-any.whl |
Release files / cached_markdown_field-0.1-py2.py3-none-any.whl
| Download URL | cached_markdown_field-0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b0409180e0de0892a321f1b2916d4907317dd5a0b637352e3db4c2571b685bce
|
|
BLAKE2b-256 checksum How to use checksums |
616cc9a46f5b474cceb61f567caed7fa18f2cce847c3db73fb25d58da5de68e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2
|
Security for cached-markdown-field 0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.