Metadata-Version: 2.1
Name: cached-markdown-field
Version: 0.1
Summary: Cached Markdown field for Django and django-markdownx
Home-page: https://github.com/pehala/cached-markdown-field
Author: Petr Hála
Author-email: halapetr@selfnet.cz
License: MIT
Keywords: django cache markdown field
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: django
Requires-Dist: django-composite-field
Requires-Dist: django-markdownx

# 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
```python
 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
```python
# 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``.


