Opened 12 years ago
Closed 12 years ago
#19133 closed Bug (fixed)
Possible regression in admin user editor
Reported by: | Daniel Swarbrick | Owned by: | nobody |
---|---|---|---|
Component: | contrib.auth | Version: | dev |
Severity: | Release blocker | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Commit c433fcb3fb34fccd69782979f0e7cd5f2d4a4893 seems to have caused a regression in at least two existing projects of mine. I zeroed in on this particular commit after doing a git bisect.
The problem can be triggered by simply opening the admin site, editing any user, and click Save without changing any fields.
The following traceback is thrown:
Environment: Request Method: POST Request URL: http://localhost:8000/admin/auth/user/1/ Django Version: 1.5.dev20121016080329 Python Version: 2.7.3 Installed Applications: ('django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.messages', 'django.contrib.sessions', 'django.contrib.staticfiles', 'diffcon', 'diffcon.netblock', 'diffcon.schedule', 'diffcon.user') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response 116. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in wrapper 367. return self.admin_site.admin_view(view)(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view 91. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/views/decorators/cache.py" in _wrapped_view_func 89. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/sites.py" in inner 202. return view(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapper 25. return bound_func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in _wrapped_view 91. response = view_func(request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/utils/decorators.py" in bound_func 21. return func(self, *args2, **kwargs2) File "/usr/lib/python2.7/dist-packages/django/db/transaction.py" in inner 208. return func(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in change_view 1054. self.save_model(request, new_object, form, True) File "/usr/lib/python2.7/dist-packages/django/contrib/admin/options.py" in save_model 710. obj.save() File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save 532. force_update=force_update, update_fields=update_fields) File "/usr/lib/python2.7/dist-packages/django/db/models/base.py" in save_base 603. rows = manager.using(using).filter(pk=pk_val)._update(values) File "/usr/lib/python2.7/dist-packages/django/db/models/query.py" in _update 580. return query.get_compiler(self.db).execute_sql(None) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql 997. cursor = super(SQLUpdateCompiler, self).execute_sql(result_type) File "/usr/lib/python2.7/dist-packages/django/db/models/sql/compiler.py" in execute_sql 825. cursor.execute(sql, params) File "/usr/lib/python2.7/dist-packages/django/db/backends/util.py" in execute 43. return self.cursor.execute(sql, params) File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py" in execute 56. six.reraise(utils.IntegrityError, utils.IntegrityError(*tuple(e.args)), sys.exc_info()[2]) File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/base.py" in execute 54. return self.cursor.execute(query, args) Exception Type: IntegrityError at /admin/auth/user/1/ Exception Value: null value in column "password" violates not-null constraint
Change History (2)
comment:1 by , 12 years ago
Has patch: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note:
See TracTickets
for help on using tickets.
Yes - this is a regression.
The issue was in the change to the password cleaning.
I have a patch here:
https://github.com/ptone/django/commit/97d79b13ad6878474f6070a80ca45269b7e9a24f
I feel like there should be a better way to do what I'm trying to do in the test- as far as creating a bound form with data as would be provided by the same form class, but unmodified. But it does test the regression WRT the password field not being passed back via the changeform.