Exemplo n.º 1
0
 def pre_save(self, model_instance, add):
     if not editor.renderer:
         return super(FiberHTMLField, self).pre_save(model_instance, add)
     else:
         # render the markup to get the html
         markup_field_name = self.name.replace('_html', '_markup')
         markup = getattr(model_instance, markup_field_name)
         return editor.renderer(markup)
Exemplo n.º 2
0
    def pre_save(self, model_instance, add):
        value = super(FiberMarkupField, self).pre_save(model_instance, add)

        if editor.renderer:
            # also save html
            html_field_name = self.name.replace('_markup', '_html')
            setattr(model_instance, html_field_name, editor.renderer(value))
        return value