コード例 #1
0
ファイル: page.py プロジェクト: mixerlabs/widgets
    def render_readonly(self):
        """Render a version of onecolumn as a snippet of formatted html."""
        title   = 'Untitled' if not self.title else self.title
        contents = ''.join(map(self.render_widget_readonly, self.ordered))

        return django_render_to_string('widgets/onecolumn_readonly.html',
                                       dict(title=title, contents=contents))
コード例 #2
0
ファイル: compat.py プロジェクト: zhouli121018/nodejsgm
 def render_to_string(template_name, context=None, request=None):
     if request is not None:
         context_instance = RequestContext(request, context)
     else:
         context_instance = Context(context)
     return django_render_to_string(template_name,
                                    context_instance=context_instance)
コード例 #3
0
ファイル: compat.py プロジェクト: Omosofe/django-wiki
 def render_to_string(template_name, context=None, request=None):
     if request is not None:
         context_instance = RequestContext(request, context)
     else:
         context_instance = Context(context)
     return django_render_to_string(template_name,
                                    context_instance=context_instance)
コード例 #4
0
ファイル: template.py プロジェクト: forgeworks/Discourse
def render_django(template, context, context_update):
    if not isinstance(context, Context):
        if 'request' in context:
            context = RequestContext(context['request'], context)
        else:
            context = Context(context)

    with context.push(context_update):
        return django_render_to_string(template, context)
コード例 #5
0
ファイル: django_util.py プロジェクト: zhuimengrenweijian/hue
def render_to_string(template, *args, **kwargs):
    """Wrapper around django.template.loader.render_to_string which supports
  different template libraries."""
    template_lib = _get_template_lib(template, kwargs)
    if template_lib == DJANGO:
        return django_render_to_string(template, *args, **kwargs)
    elif template_lib == MAKO:
        return django_mako.render_to_string(template, *args, **kwargs)
    else:
        raise Exception("Bad template lib: %s" % template_lib)
コード例 #6
0
ファイル: django_util.py プロジェクト: atm/hue
def render_to_string(template, *args, **kwargs):
  """Wrapper around django.template.loader.render_to_string which supports
  different template libraries."""
  template_lib = _get_template_lib(template, kwargs)
  if template_lib == DJANGO:
    return django_render_to_string(template, *args, **kwargs)
  elif template_lib == MAKO:
    return django_mako.render_to_string(template, *args, **kwargs)
  else:
    raise Exception("Bad template lib: %s" % template_lib)
コード例 #7
0
ファイル: page.py プロジェクト: mixerlabs/widgets
    def render_embed(self, about, city_layout=False):
        """Render a version of onecolumn embeddable by city, business
        pages, etc.  If city_layout is True, use an alternate layout that
        doesn't use a header bar for the embed. """
        template, context = \
            self.base_template_and_context('widgets/onecolumn_embed.html')
        context['about'] = about
        context['city_layout'] = city_layout

        return django_render_to_string(template, context)
コード例 #8
0
def render_to_string(template_name, dictionary=None, context_instance=None):
    if not dictionary:
        dictionary = {}

    if isinstance(dictionary, dict):
        newdict = get_branding_dict("BRANDING")
        newdict.update(dictionary)
    else:
        newdict = dictionary

    return django_render_to_string(template_name, newdict, context_instance)
コード例 #9
0
ファイル: sending.py プロジェクト: peterbe/generousfriends
def render_to_string(templ, context):
    context.update({
        'PROJECT_TITLE': settings.PROJECT_TITLE,
        'PROJECT_STRAPLINE': settings.PROJECT_STRAPLINE,
    })
    return django_render_to_string(templ, context)
コード例 #10
0
ファイル: plugins.py プロジェクト: ximion/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    from misago.template.theme import prefix_templates
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name,
                                   dictionary,
                                   context_instance=context_instance)
コード例 #11
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
コード例 #12
0
ファイル: loader.py プロジェクト: ximion/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    dictionary = process_context(template_name, dictionary, context_instance)
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name, dictionary)
コード例 #13
0
ファイル: utils.py プロジェクト: lhs950204/framework
def render_to_string(template, context):
    html = django_render_to_string(template, context)
    assert "This_is_not_INVALID" not in html
    return html
コード例 #14
0
ファイル: template.py プロジェクト: gitter-badger/chcemvediet
def render_to_string(template_name, dictionary=None, context_instance=None, dirs=None):
    if context_instance is None:
        request = get_request()
        if request is not None:
            context_instance = RequestContext(request)
    return django_render_to_string(template_name, dictionary, context_instance, dirs)
コード例 #15
0
ファイル: plugins.py プロジェクト: 0x1330/Misago
def render_to_string(template_name, dictionary=None, context_instance=None):
    from misago.template.theme import prefix_templates
    template_name = prefix_templates(template_name)
    return django_render_to_string(template_name,
                                   dictionary,
                                   context_instance=context_instance)
コード例 #16
0
 def render_to_string(template_name, context=None):
     return django_render_to_string(template_name, dictionary=context)
コード例 #17
0
ファイル: page.py プロジェクト: mixerlabs/widgets
 def get_edit_info(self):
     return django_render_to_string(
         'widgets/_onecolumn_edit_info.html', {'page': self})
コード例 #18
0
ファイル: views.py プロジェクト: Saevon/webdnd
def render_to_string(template_name, *args, **kwargs):
    return django_render_to_string(template_name, *args, **kwargs)