=== modified file 'django/contrib/admin/options.py'
--- django/contrib/admin/options.py	2007-11-30 13:28:56 +0000
+++ django/contrib/admin/options.py	2007-11-30 14:03:58 +0000
@@ -459,7 +459,8 @@
         request.user.message_set.create(message=msg)
         return HttpResponseRedirect(redirect_url) 
 
-    def render_change_form(self, model, context, add=False, change=False, form_url=''):
+    def render_change_form(self, request, context, add=False, change=False):
+        model = self.model
         opts = model._meta
         app_label = opts.app_label
         ordered_objects = opts.get_ordered_objects()
@@ -471,10 +472,11 @@
             'has_file_field': True, # FIXME - this should check if form or formsets have a FileField,
             'has_absolute_url': hasattr(model, 'get_absolute_url'),
             'ordered_objects': ordered_objects,
-            'form_url': mark_safe(form_url),
             'opts': opts,
             'content_type_id': ContentType.objects.get_for_model(model).id,
             'save_on_top': self.save_on_top,
+            'save_as': self.save_as,
+            'is_save_as': request.POST.has_key('_saveasnew'),
         }
         context.update(extra_context)
         return render_to_response([
@@ -482,7 +484,7 @@
             "admin/%s/change_form.html" % app_label,
             "admin/change_form.html"], context_instance=context)
 
-    def add_view(self, request, form_url=''):
+    def add_view(self, request):
         "The 'add' admin view for this model."
         model = self.model
         opts = model._meta
@@ -527,7 +529,7 @@
             'media': media,
             'inline_admin_formsets': inline_admin_formsets,
         })
-        return self.render_change_form(model, c, add=True)
+        return self.render_change_form(request, c, add=True)
     
     def change_view(self, request, object_id):
         "The 'change' admin view for this model."
@@ -549,8 +551,8 @@
         if obj is None:
             raise Http404('%s object with primary key %r does not exist.' % (opts.verbose_name, escape(object_id)))
 
-        if request.POST and request.POST.has_key("_saveasnew"):
-            return self.add_view(request, form_url='../../add/')
+        if request.POST and request.POST.has_key('_saveasnew'):
+            return self.add_view(request)
 
         ModelForm = self.form_change(request, obj)
         inline_formsets = []
@@ -604,7 +606,7 @@
             'media': media,
             'inline_admin_formsets': inline_admin_formsets,
         })
-        return self.render_change_form(model, c, change=True)
+        return self.render_change_form(request, c, change=True)
 
     def changelist_view(self, request):
         "The 'change list' admin view for this model."

=== modified file 'django/contrib/admin/templates/admin/change_form.html'
--- django/contrib/admin/templates/admin/change_form.html	2007-11-30 09:51:14 +0000
+++ django/contrib/admin/templates/admin/change_form.html	2007-11-30 10:59:35 +0000
@@ -30,7 +30,7 @@
   </ul>
 {% endif %}{% endif %}
 {% endblock %}
-<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
+<form {% if has_file_field %}enctype="multipart/form-data" {% endif %}action="." method="post" id="{{ opts.module_name }}_form">{% block form_top %}{% endblock %}
 <div>
 {% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
 {% if save_on_top %}{% submit_row %}{% endif %}

=== modified file 'django/contrib/admin/templatetags/admin_modify.py'
--- django/contrib/admin/templatetags/admin_modify.py	2007-11-30 09:51:14 +0000
+++ django/contrib/admin/templatetags/admin_modify.py	2007-11-30 10:59:35 +0000
@@ -18,20 +18,20 @@
 
 def submit_row(context):
     opts = context['opts']
+    add = context['add']
     change = context['change']
     is_popup = context['is_popup']
-    # TODO: Fix this hack.
-    # save_as = opts.admin.save_as
-    save_as = False
+    save_as = context['save_as']
+    is_save_as = context['is_save_as'] 
     return {
         'onclick_attrib': (opts.get_ordered_objects() and change
                             and 'onclick="submitOrderForm();"' or ''),
         'show_delete_link': (not is_popup and context['has_delete_permission']
                               and (change or context['show_delete'])),
-        'show_save_as_new': not is_popup and change and save_as,
-        'show_save_and_add_another': not is_popup and (not save_as or context['add']),
-        'show_save_and_continue': not is_popup and context['has_change_permission'],
-        'show_save': True
+        'show_save_as_new': not is_popup and save_as and (is_save_as or change),
+        'show_save_and_add_another': not is_popup and not is_save_as and (add or not save_as),
+        'show_save_and_continue': not is_popup and not is_save_as and context['has_change_permission'],
+        'show_save':  not is_save_as, 
     }
 submit_row = register.inclusion_tag('admin/submit_line.html', takes_context=True)(submit_row)
 

=== modified file 'django/contrib/admin/views/auth.py'
--- django/contrib/admin/views/auth.py	2007-11-13 02:22:00 +0000
+++ django/contrib/admin/views/auth.py	2007-11-13 02:19:13 +0000
@@ -40,6 +40,8 @@
         'auto_populated_fields': (),
         'opts': User._meta,
         'username_help_text': User._meta.get_field('username').help_text,
+        'save_as': False,
+        'is_save_as': False,
     }, context_instance=template.RequestContext(request))
 user_add_stage = staff_member_required(user_add_stage)
 
@@ -71,5 +73,7 @@
         'opts': User._meta,
         'original': user,
         'show_save': True,
+        'save_as': False,
+        'is_save_as': False,
     }, context_instance=template.RequestContext(request))
 user_change_password = staff_member_required(user_change_password)

