Index: django/template/__init__.py
===================================================================
--- django/template/__init__.py	(revision 2979)
+++ django/template/__init__.py	(working copy)
@@ -834,6 +834,37 @@
         self.tag(func.__name__, compile_func)
         return func
 
+    def object_tag(self, func):
+        """
+        Makes it easier to write template tags that load objects into the template.
+        These tags are of the form (tag) [args] as (varname)
+        For example: get_some_articles 5 as recent_articles
+        
+        object_tag should be used to decorate a function that takes [args] as its
+        parameters and returns the object to be assigned to (varname) in the template.
+        For example:
+        @register.object_tag
+        def get_some_articles(num):
+            return MyArticleModel.objects.all()[:num]
+        """
+        def compile_func(parser, token):
+            bits = token.contents.split(None)
+            tagname, bits = bits[0], bits[1:]
+            if len(bits) < 2 or bits[-2] != "as":
+                raise TemplateSyntaxError, "Tag must be of format %s [args] as (varname)" % tagname
+            args, varname = bits[:-2], bits[-1]
+            
+            class ObjectTagNode(Node):
+                def render(self, context):
+                    context[varname] = func(*args)
+                    return ''
+            
+            return ObjectTagNode()
+        
+        compile_func.__doc__ = func.__doc__
+        self.tag(func.__name__, compile_func)
+        return func
+
     def inclusion_tag(self, file_name, context_class=Context, takes_context=False):
         def dec(func):
             (params, xx, xxx, defaults) = getargspec(func)
