Ticket #8933: ticket8933-r8979.2.diff

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

small fix to appease SmilyChris' niticking

  • django/contrib/admin/sites.py

    diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
    index c16ab6a..3f5ff8f 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):  
    181184        Handles the "change password" task -- both form display and validation.
    182185        """
    183186        from django.contrib.auth.views import password_change
    184         return password_change(request,
    185             post_change_redirect='%spassword_change/done/' % self.root_path)
     187        redirect_to = '%spassword_change/done/' % self.root_path
     188        if self.password_change_template is None:
     189            return password_change(request, post_change_redirect=redirect_to)
     190        return password_change(request, post_change_redirect=redirect_to,
     191            template_name=self.password_change_template)
    186192
    187193    def password_change_done(self, request):
    188194        """
    189195        Displays the "success" page after a password change.
    190196        """
    191197        from django.contrib.auth.views import password_change_done
    192         return password_change_done(request)
     198        if self.password_change_done_template is None:
     199            return password_change_done(request)
     200        return password_change_done(request,
     201            template_name=self.password_change_done_template)
    193202
    194203    def i18n_javascript(self, request):
    195204        """
    class AdminSite(object):  
    211220        This should *not* assume the user is already logged in.
    212221        """
    213222        from django.contrib.auth.views import logout
    214         return logout(request)
     223        if self.logout_template is None:
     224            return logout(request)
     225        return logout(request, template_name=self.logout_template)
    215226    logout = never_cache(logout)
    216227
    217228    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