diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-23 21:45:36 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-08-23 21:45:36 +0000 |
| commit | aa78a05e693e26308c6ad98242709b2e4ed8367d (patch) | |
| tree | a566df4f2e5ad65fadca301c5f0bf950509b81e0 | |
| parent | 712bb0dde7d935d4a7703635c821ea63f60997c7 (diff) | |
Fixed #8359 -- Add an admin log entry when creating a new user.
Patch from evan_schulz.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8503 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/contrib/auth/admin.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/contrib/auth/admin.py b/django/contrib/auth/admin.py index 85a183aeea..c64cf90256 100644 --- a/django/contrib/auth/admin.py +++ b/django/contrib/auth/admin.py @@ -30,7 +30,7 @@ class UserAdmin(admin.ModelAdmin): search_fields = ('username', 'first_name', 'last_name', 'email') ordering = ('username',) filter_horizontal = ('user_permissions',) - + def __call__(self, request, url): # this should not be here, but must be due to the way __call__ routes # in ModelAdmin. @@ -39,7 +39,7 @@ class UserAdmin(admin.ModelAdmin): if url.endswith('password'): return self.user_change_password(request, url.split('/')[0]) return super(UserAdmin, self).__call__(request, url) - + def add_view(self, request): if not self.has_change_permission(request): raise PermissionDenied @@ -48,6 +48,7 @@ class UserAdmin(admin.ModelAdmin): if form.is_valid(): new_user = form.save() msg = _('The %(name)s "%(obj)s" was added successfully.') % {'name': 'user', 'obj': new_user} + self.log_addition(request, new_user) if "_addanother" in request.POST: request.user.message_set.create(message=msg) return HttpResponseRedirect(request.path) @@ -73,7 +74,7 @@ class UserAdmin(admin.ModelAdmin): 'username_help_text': self.model._meta.get_field('username').help_text, 'root_path': self.admin_site.root_path, }, context_instance=template.RequestContext(request)) - + def user_change_password(self, request, id): if not request.user.has_perm('auth.change_user'): raise PermissionDenied |
