Задать вопрос

Тел: +7 965 3737 888

465

Просмотров

3

Ответов

MarkdownTextField

<p>A <a href="http://code.djangoproject.com/wiki/UsingMarkup">common pattern in Django</a> is to create a TextField intended for Markdown text (i.e. description) and a companion non-editable TextField for storing the HTML version (i.e. description_html), so the Markdown converter need not be run for every page view.<br></p>
<p>This snippet is a custom field which encapsulates this pattern in a single field which can automatically create and update its companion HTML field.
</p>
<p>Usage:
</p>
class MyModel(models.Model):
    description = MarkdownTextField()

Вопрос полезен? Да0/Нет0
file_3926.py(1.6Кб)
None

Ответы (3):

Ответartur_mwaigaryan:27.03.2013
Ответ полезен? Да0/Нет0

hmmm...this error pops up:

'NoneType' object has no attribute 'strip'

Ответsvetlyak:06.11.2008
Ответ полезен? Да0/Нет0

I belive, that if you don't want to call markdown or any other postprocessor at any page view, then you should use Cache.

Storing additional data in the database is a bad idea, if you want to archieve a performance.

Ответmarvoloe:15.07.2008
Ответ полезен? Да0/Нет0

Awesome idea. Great implemented!