View decorator to automate templates.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
############################
def with_template(template):
   def wrapper(view):
      def call(request, *args, **kwargs):
         context = {}
         ret = view(request, context, *args, **kwargs)
         if ret: return(ret)
         return(render_to_response(template, RequestContext(request, context)))
      return(call)
   return(wrapper)

More like this

  1. Sort Table Headers by insin 6 years, 9 months ago
  2. render_with decorator by tobias 5 years, 7 months ago
  3. Automatically create urls for templates in a directory by blackrobot 2 years, 5 months ago
  4. Analogue template filter to removetags that also removes the content of the tag by piquadrat 3 years, 5 months ago
  5. SWFUpload auth decorator by debrice 5 years, 2 months ago

Comments

(Forgotten your password?)