Ticket #8670: auth_add_view.diff
File auth_add_view.diff, 1.4 KB (added by , 16 years ago) |
---|
-
contrib/auth/admin.py
old new 41 41 return self.user_change_password(request, url.split('/')[0]) 42 42 return super(UserAdmin, self).__call__(request, url) 43 43 44 def add_view(self, request ):44 def add_view(self, request, extra_context=None): 45 45 if not self.has_change_permission(request): 46 46 raise PermissionDenied 47 47 if request.method == 'POST': … … 58 58 return HttpResponseRedirect('../%s/' % new_user.id) 59 59 else: 60 60 form = self.add_form() 61 return render_to_response('admin/auth/user/add_form.html',{61 context = { 62 62 'title': _('Add user'), 63 63 'form': form, 64 64 'is_popup': '_popup' in request.REQUEST, … … 75 75 'username_help_text': self.model._meta.get_field('username').help_text, 76 76 'root_path': self.admin_site.root_path, 77 77 'app_label': self.model._meta.app_label, 78 }, context_instance=template.RequestContext(request)) 78 } 79 context.update(extra_context or {}) 80 return render_to_response('admin/auth/user/add_form.html', context, 81 context_instance=template.RequestContext(request)) 79 82 80 83 def user_change_password(self, request, id): 81 84 if not request.user.has_perm('auth.change_user'):