Ticket #8933: ticket8933-r8979.diff

File ticket8933-r8979.diff, 3.2 KB (added by Jannis Leidel, 16 years ago)

fix to make more templates overridable

  • django/contrib/admin/sites.py

    diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
    index 0be93a2..aea856a 100644
    a b class AdminSite(object):  
    3333    index_template = None
    3434    login_template = None
    3535    app_index_template = None
     36    logout_template = None
     37    password_change_template = None
     38    password_change_done_template = None
    3639
    3740    def __init__(self):
    3841        self._registry = {} # model_class class -> admin_class instance
    class AdminSite(object):  
    183186        """
    184187        from django.contrib.auth.views import password_change
    185188        return password_change(request,
    186             post_change_redirect='%spassword_change/done/' % self.root_path)
     189            template_name=self.password_change_template or 'registration/password_change_form.html',
     190            post_change_redirect='%spassword_change/done/' % self.root_path
     191        )
    187192
    188193    def password_change_done(self, request):
    189194        """
    190195        Displays the "success" page after a password change.
    191196        """
    192197        from django.contrib.auth.views import password_change_done
    193         return password_change_done(request)
     198        return password_change_done(request,
     199            template_name=self.password_change_done_template or 'registration/password_change_done.html'
     200        )
    194201
    195202    def i18n_javascript(self, request):
    196203        """
    class AdminSite(object):  
    212219        This should *not* assume the user is already logged in.
    213220        """
    214221        from django.contrib.auth.views import logout
    215         return logout(request)
     222        return logout(request,
     223            template_name=self.logout_template or 'registration/logged_out.html'
     224        )
    216225    logout = never_cache(logout)
    217226
    218227    def login(self, request):
  • django/contrib/auth/admin.py

    diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py
    index 1e4c480..a38b748 100644
    a b class GroupAdmin(admin.ModelAdmin):  
    1616    filter_horizontal = ('permissions',)
    1717
    1818class UserAdmin(admin.ModelAdmin):
     19    add_form_template = None
     20    change_user_password_template = None
    1921    fieldsets = (
    2022        (None, {'fields': ('username', 'password')}),
    2123        (_('Personal info'), {'fields': ('first_name', 'last_name', 'email')}),
    class UserAdmin(admin.ModelAdmin):  
    6062                    return HttpResponseRedirect('../%s/' % new_user.id)
    6163        else:
    6264            form = self.add_form()
    63         return render_to_response('admin/auth/user/add_form.html', {
     65        return render_to_response(self.add_form_template or 'admin/auth/user/add_form.html', {
    6466            'title': _('Add user'),
    6567            'form': form,
    6668            'is_popup': '_popup' in request.REQUEST,
    class UserAdmin(admin.ModelAdmin):  
    9294                return HttpResponseRedirect('..')
    9395        else:
    9496            form = self.change_password_form(user)
    95         return render_to_response('admin/auth/user/change_password.html', {
     97        return render_to_response(self.change_user_password_template or 'admin/auth/user/change_password.html', {
    9698            'title': _('Change password: %s') % escape(user.username),
    9799            'form': form,
    98100            'is_popup': '_popup' in request.REQUEST,
Back to Top