Changes between Version 4 and Version 5 of UsingMarkup


Ignore:
Timestamp:
05/31/06 01:23:37 (9 years ago)
Author:
David Larlet <larlet@…>
Comment:

Post magic removal correction

Legend:

Unmodified
Added
Removed
Modified
  • UsingMarkup

    v4 v5  
    2727
    2828Now you've got the same effect: when creating or editing entries in the admin, you'll only see the field which accepts Markdown syntax, but when saving, the body_markdown field will be auto-filled with the corresponding XHTML. Then in your template, you can pull in entry.body_markdown, and save yourself a little processing time.
     29
     30
     31----
     32
     33
     34'''Update:'''
     35
     36Due to magic-removal, the ''_pre_save()'' function is not required, instead use :
     37
     38{{{
     39#!python
     40
     41    def save(self):
     42        import markdown
     43        self.body_markdown = markdown.markdown(self.body)
     44        super(Entry, self).save() # Call the "real" save() method.
     45}}}
     46
     47More information on http://code.djangoproject.com/wiki/RemovingTheMagic#Overridingsaveanddeletemodelmethods
Back to Top