示例#1
0
    def render_to_string(self):

        # add always needed info
        var_dict = self.var_dict
        # add login info
        from common.auth import get_current_user, Guest
        user = get_current_user()
        user_info = {'login_user': user, 'is_not_guest': user != Guest}
        var_dict.update(user_info)

        from home.models import Site
        site_info = {'site': Site.get_instance()}
        var_dict.update(site_info)

        from chrisw.helper.django_helper import render_to_string
        return render_to_string(self.name + ".html", self.var_dict)
示例#2
0
 def render(self, context):
   """docstring for render"""
   
   stream = context[self.stream_name]
   display_name = self.display_name
   
   context.update(locals())
   
   if not stream:
     return "Skipped"
   
   if stream.target_type == TEXT_STREAM or stream.target_type is None:
     return render_to_string("item_text_user_stream.html", context)
   
   raise Exception("Can't render this type of stream %s %s" % \
     (stream, stream.target_type))
示例#3
0
    def render(self, context):
        """docstring for render"""

        stream = context[self.stream_name]
        display_name = self.display_name

        context.update(locals())

        if not stream:
            return "Skipped"

        if stream.target_type == TEXT_STREAM or stream.target_type is None:
            return render_to_string("item_text_user_stream.html", context)

        raise Exception("Can't render this type of stream %s %s" % \
          (stream, stream.target_type))