예제 #1
0
 def save(self, *args, **kwargs):
     # We store it in any case to also check the parser for possible exceptions and to use it for __unicode__
     (content, parser) = utils.markup_parser(self.body, self.markup)
     self.body_html = content
     self.body_scripts = '\n'.join(parser.get_scripts())
     self.body_stylesheets = '\n'.join(parser.get_stylesheets())
     if not utils.get_markup_object(self.markup).is_dynamic:
         self.dynamic = False
     return super(MarkupField, self).save(*args, **kwargs)
예제 #2
0
 def save(self, *args, **kwargs):
     # We store it in any case to also check the parser for possible exceptions and to use it for __unicode__
     (content, parser) = utils.markup_parser(self.body, self.markup)
     self.body_html = content
     self.body_scripts = '\n'.join(parser.get_scripts())
     self.body_stylesheets = '\n'.join(parser.get_stylesheets())
     if not utils.get_markup_object(self.markup).is_dynamic:
         self.dynamic = False
     return super(MarkupField, self).save(*args, **kwargs)
예제 #3
0
 def render(self, context):
     if self.dynamic:
         (content, parser) = utils.markup_parser(self.body, self.markup, context, context.get('placeholder'))
         context['markup_scripts'] = context.get('markup_scripts', []) + parser.get_scripts()
         context['markup_stylesheets'] = context.get('markup_stylesheets', []) + parser.get_stylesheets()
         return mark_safe(content)
     else:
         context['markup_scripts'] = context.get('markup_scripts', []) + self.body_scripts.split('\n')
         context['markup_stylesheets'] = context.get('markup_stylesheets', []) + self.body_stylesheets.split('\n')
         return mark_safe(self.body_html)
예제 #4
0
 def render(self, context):
     if self.dynamic:
         (content, parser) = utils.markup_parser(self.body, self.markup,
                                                 context,
                                                 context.get('placeholder'))
         context['markup_scripts'] = context.get('markup_scripts',
                                                 []) + parser.get_scripts()
         context['markup_stylesheets'] = context.get(
             'markup_stylesheets', []) + parser.get_stylesheets()
         return mark_safe(content)
     else:
         context['markup_scripts'] = context.get(
             'markup_scripts', []) + self.body_scripts.split('\n')
         context['markup_stylesheets'] = context.get(
             'markup_stylesheets', []) + self.body_stylesheets.split('\n')
         return mark_safe(self.body_html)
예제 #5
0
 def render(self, context):
     if self.dynamic:
         return mark_safe(utils.markup_parser(self.body, self.markup, context, context.get('placeholder')))
     else:
         return mark_safe(self.body_html)
예제 #6
0
 def save(self, *args, **kwargs):
     # We store it in any case to also check the parser for possible exceptions and to use it for __unicode__
     self.body_html = utils.markup_parser(self.body, self.markup)
     if not utils.get_markup_object(self.markup).is_dynamic:
         self.dynamic = False
     return super(MarkupField, self).save(*args, **kwargs)