Example #1
0
 def get_form_template(self, request, template=None, context=None):
     """
     :Returns: Rendered form template with the given context, if any.
     """
     if not context:
         context = RequestContext(request)
     with update_context(context, {'form': self.get_form(request, prefix=self.get_form_prefix())}):
         return render_to_string(template or self.edit_templates, context)
Example #2
0
 def render(self, context, template=None):
     """
     A ``template`` kwarg can be passed to use an explictly defined template
     instead of the default template list.
     """
     with update_context(context, {'self': self}):
         return render_to_string(
             template or self.get_render_templates(context), context)
Example #3
0
 def render(self, context, template=None):
     """
     A ``template`` kwarg can be passed to use an explictly defined template
     instead of the default template list.
     """
     with update_context(context, {'self': self}):
         return render_to_string(
             template or self.get_render_templates(context),
             context
         )
Example #4
0
 def get_form_template(self, request, template=None, context=None):
     """
     :Returns: Rendered form template with the given context, if any.
     """
     if not context:
         context = RequestContext(request)
     with update_context(
             context,
         {'form': self.get_form(request, prefix=self.get_form_prefix())}):
         return render_to_string(template or self.edit_templates, context)
Example #5
0
 def get_preview_template(self, site):
     """
     :Returns: Rendered preview template.
     """
     return render_to_string(self.preview_templates, {
         'self': self,
         'edit_url': site.reverse(site.node_edit_view, kwargs={
             'node_pk': self.node.pk,
         }),
         'site': site,
     })
Example #6
0
 def get_preview_template(self, site):
     """
     :Returns: Rendered preview template.
     """
     return render_to_string(
         self.preview_templates, {
             'self':
             self,
             'edit_url':
             site.reverse(site.node_edit_view,
                          kwargs={
                              'node_pk': self.node.pk,
                          }),
             'site':
             site,
         })