Opened 6 years ago

Closed 6 years ago

#19133 closed Bug (fixed)

Possible regression in admin user editor

Reported by: Daniel Swarbrick Owned by: nobody
Component: contrib.auth Version: master
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


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:


Request Method: POST
Request URL: http://localhost:8000/admin/auth/user/1/

Django Version: 1.5.dev20121016080329
Python Version: 2.7.3
Installed Applications:
Installed Middleware:

File "/usr/lib/python2.7/dist-packages/django/core/handlers/" in get_response
  116.                         response = callback(request, *callback_args, **callback_kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/" in wrapper
  367.                 return self.admin_site.admin_view(view)(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/decorators/" in _wrapped_view_func
  89.         response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/" in inner
  202.             return view(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/utils/" in _wrapper
  25.             return bound_func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/utils/" in _wrapped_view
  91.                     response = view_func(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/utils/" in bound_func
  21.                 return func(self, *args2, **kwargs2)
File "/usr/lib/python2.7/dist-packages/django/db/" in inner
  208.                 return func(*args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/" in change_view
  1054.                 self.save_model(request, new_object, form, True)
File "/usr/lib/python2.7/dist-packages/django/contrib/admin/" in save_model
File "/usr/lib/python2.7/dist-packages/django/db/models/" in save
  532.                        force_update=force_update, update_fields=update_fields)
File "/usr/lib/python2.7/dist-packages/django/db/models/" in save_base
  603.                             rows = manager.using(using).filter(pk=pk_val)._update(values)
File "/usr/lib/python2.7/dist-packages/django/db/models/" in _update
  580.         return query.get_compiler(self.db).execute_sql(None)
File "/usr/lib/python2.7/dist-packages/django/db/models/sql/" in execute_sql
  997.         cursor = super(SQLUpdateCompiler, self).execute_sql(result_type)
File "/usr/lib/python2.7/dist-packages/django/db/models/sql/" in execute_sql
  825.         cursor.execute(sql, params)
File "/usr/lib/python2.7/dist-packages/django/db/backends/" in execute
  43.             return self.cursor.execute(sql, params)
File "/usr/lib/python2.7/dist-packages/django/db/backends/postgresql_psycopg2/" 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/" 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 Changed 6 years ago by Preston Holmes

Has patch: set
Triage Stage: UnreviewedAccepted

Yes - this is a regression.

The issue was in the change to the password cleaning.

I have a patch here:

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.

comment:2 Changed 6 years ago by Russell Keith-Magee <russell@…>

Resolution: fixed
Status: newclosed

In 04b53ebfb7f45d64d73be33f536b422e179aacbf:

Fixed #19133 -- Corrected regression in form handling for user passwords.

Thanks to pressureman for the report, and to Preston Holmes for the draft patch.

Note: See TracTickets for help on using tickets.
Back to Top