Index: django/template/defaulttags.py
===================================================================
--- django/template/defaulttags.py	(revision 3768)
+++ django/template/defaulttags.py	(working copy)
@@ -120,15 +120,22 @@
         return nodelist.render(context)
 
 class IfChangedNode(Node):
-    def __init__(self, nodelist):
+    def __init__(self, nodelist, var1=None):
         self.nodelist = nodelist
         self._last_seen = None
+        self._var1 = var1
 
     def render(self, context):
-        content = self.nodelist.render(context)
-        if content != self._last_seen:
+        try:
+            if self._var1==None:
+                compare_to = self.nodelist.render(context)
+            else:
+                compare_to = resolve_variable(self._var1, context)
+        except VariableDoesNotExist:
+            compare_to = None        
+        if  compare_to != self._last_seen:
             firstloop = (self._last_seen == None)
-            self._last_seen = content
+            self._last_seen = compare_to
             context.push()
             context['ifchanged'] = {'firstloop': firstloop}
             content = self.nodelist.render(context)
@@ -626,23 +633,27 @@
     """
     Check if a value has changed from the last iteration of a loop.
 
-    The 'ifchanged' block tag is used within a loop. It checks its own rendered
-    contents against its previous state and only displays its content if the
-    value has changed::
+    The 'ifchanged' block tag is used within a loop. It has two possible uses.
+    1) It checks its own rendered contents against its previous state and 
+    only displays its content if the value has changed.
+    2) It checks if the given variable has changed. ::
 
         <h1>Archive for {{ year }}</h1>
 
         {% for date in days %}
         {% ifchanged %}<h3>{{ date|date:"F" }}</h3>{% endifchanged %}
+        {% ifchanged date %}date has changed{% endifchanged %}
         <a href="{{ date|date:"M/d"|lower }}/">{{ date|date:"j" }}</a>
         {% endfor %}
     """
     bits = token.contents.split()
-    if len(bits) != 1:
-        raise TemplateSyntaxError, "'ifchanged' tag takes no arguments"
+    if len(bits) > 2:
+        raise TemplateSyntaxError, "'ifchanged' tag takes either one or none argument"
+    if len(bits) == 1:
+        bits.append(None)
     nodelist = parser.parse(('endifchanged',))
     parser.delete_first_token()
-    return IfChangedNode(nodelist)
+    return IfChangedNode(nodelist, bits[1])
 ifchanged = register.tag(ifchanged)
 
 #@register.tag

