Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: do not require storing of rendered text #19

Open
bernd-wechner opened this issue Feb 26, 2023 · 0 comments
Open

Feature request: do not require storing of rendered text #19

bernd-wechner opened this issue Feb 26, 2023 · 0 comments

Comments

@bernd-wechner
Copy link
Contributor

I do see the performance advantage of storing rendered Markdown, but also wonder why there is no documented means for avoiding it. It seems a perfectly valid and common use case to me, to store only the markdown and render on, well, rendering the template. That is rather than:

from django.db import models

from markdownfield.models import MarkdownField, RenderedMarkdownField
from markdownfield.validators import VALIDATOR_STANDARD

class Page(models.Model):
    text = MarkdownField(rendered_field='text_rendered', validator=VALIDATOR_STANDARD)
    text_rendered = RenderedMarkdownField()

and in templates:

{{ post.text_rendered | safe }}

something more like:

from django.db import models

from markdownfield.models import MarkdownField
from markdownfield.validators import VALIDATOR_STANDARD

class Page(models.Model):
    text = MarkdownField(validator=VALIDATOR_STANDARD)

and in templates:

{{ post.text | render_markdown }}

Not only is that use case to my mind very valid, I think that the render_markdown filter would find broader use in templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant