~ubuntu-branches/debian/sid/python-django/sid

« back to all changes in this revision

Viewing changes to django/contrib/auth/admin.py

  • Committer: Package Import Robot
  • Author(s): Raphaël Hertzog
  • Date: 2014-09-17 14:15:11 UTC
  • mfrom: (1.3.17) (6.2.18 experimental)
  • Revision ID: package-import@ubuntu.com-20140917141511-icneokthe9ww5sk4
Tags: 1.7-2
* Release to unstable.
* Add a migrate-south sample script to help users apply their South
  migrations. Thanks to Brian May.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
from django.conf import settings
3
3
from django.contrib import admin
4
4
from django.contrib.admin.options import IS_POPUP_VAR
 
5
from django.contrib.auth import update_session_auth_hash
5
6
from django.contrib.auth.forms import (UserCreationForm, UserChangeForm,
6
7
    AdminPasswordChangeForm)
7
8
from django.contrib.auth.models import User, Group
48
49
    add_fieldsets = (
49
50
        (None, {
50
51
            'classes': ('wide',),
51
 
            'fields': ('username', 'password1', 'password2')}
52
 
        ),
 
52
            'fields': ('username', 'password1', 'password2'),
 
53
        }),
53
54
    )
54
55
    form = UserChangeForm
55
56
    add_form = UserCreationForm
71
72
        """
72
73
        defaults = {}
73
74
        if obj is None:
74
 
            defaults.update({
75
 
                'form': self.add_form,
76
 
                'fields': admin.util.flatten_fieldsets(self.add_fieldsets),
77
 
            })
 
75
            defaults['form'] = self.add_form
78
76
        defaults.update(kwargs)
79
77
        return super(UserAdmin, self).get_form(request, obj, **defaults)
80
78
 
135
133
                self.log_change(request, user, change_message)
136
134
                msg = ugettext('Password changed successfully.')
137
135
                messages.success(request, msg)
 
136
                update_session_auth_hash(request, form.user)
138
137
                return HttpResponseRedirect('..')
139
138
        else:
140
139
            form = self.change_password_form(user)
147
146
            'adminForm': adminForm,
148
147
            'form_url': form_url,
149
148
            'form': form,
150
 
            'is_popup': IS_POPUP_VAR in request.REQUEST,
 
149
            'is_popup': (IS_POPUP_VAR in request.POST or
 
150
                         IS_POPUP_VAR in request.GET),
151
151
            'add': True,
152
152
            'change': False,
153
153
            'has_delete_permission': False,
158
158
            'save_as': False,
159
159
            'show_save': True,
160
160
        }
 
161
        context.update(admin.site.each_context())
161
162
        return TemplateResponse(request,
162
163
            self.change_user_password_template or
163
164
            'admin/auth/user/change_password.html',