Django

Code

Ticket #8359 (closed: fixed)

Opened 4 months ago

Last modified 3 months ago

Adding a user in admin doesn't create a LogEntry for the addition

Reported by: evan_schulz Assigned to: nobody
Milestone: 1.0 Component: django.contrib.admin
Version: SVN Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

Description

UserAdmin?'s add_view method doesn't call the log_addition method to create a record that the new user was created which means you'll get the incorrect message "object doesn't have a change history. It probably wasn't added via this admin site" when viewing the user history.

Attachments

8359.diff (0.6 kB) - added by evan_schulz on 08/16/08 02:41:04.
8359choices.diff (1.8 kB) - added by rockmhoward@gmail.com on 08/18/08 00:59:25.
Optional additional patch to fix object history display.

Change History

08/16/08 02:41:04 changed by evan_schulz

  • attachment 8359.diff added.

08/16/08 15:56:01 changed by Alex

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Ready for checkin.
  • needs_tests changed.
  • milestone set to 1.0.

08/16/08 17:28:59 changed by mtredinnick

A bit hard to verify the fix until #8353 has been fixed. :-)

08/16/08 18:12:02 changed by evan_schulz

FWIW there is a small patch in #8357 to get user creation working again for quick verification purposes

08/18/08 00:59:25 changed by rockmhoward@gmail.com

  • attachment 8359choices.diff added.

Optional additional patch to fix object history display.

08/18/08 01:03:54 changed by rockmhoward@gmail.com

The 8359choices.diff patch fixes the problem whereby the object history displays no action when no change_message was specified. With this fix a default action description ("Added.", "Changed." or "Deleted.") is displayed based on the action_flag setting when change_message is not set.

(follow-up: ↓ 7 ) 08/23/08 16:39:09 changed by mtredinnick

The second patch should go into a new ticket and we can consider that after 1.0. It's a feature addition, since it restricts the choices on the actions available in the LogEntry model, which may or may not be what we want to do.

08/23/08 16:45:37 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

(In [8503]) Fixed #8359 -- Add an admin log entry when creating a new user. Patch from evan_schulz.

(in reply to: ↑ 5 ) 08/23/08 19:32:25 changed by rockmhoward@gmail.com

Replying to mtredinnick:

The second patch should go into a new ticket and we can consider that after 1.0. It's a feature addition, since it restricts the choices on the actions available in the LogEntry model, which may or may not be what we want to do.

This is a weak decision. First off, the bug as submitted is not entirely fixed without the second patch since the logentry for the user addition still does not show up as an addition in the object history. Second, the choices on the action_flag are already restricted to a SmallPositiveInteger?. If you are seriously concerned about restricting the values, you need to change this to an IntegerField? at the very least. Third, set theory suggests that the defined actions -- addition, deletion and change -- are all of the possible actions available for any object. There are no other choices that would not logically overlap the available choices. If you want to argue that set theory is incomplete and new types of state transitions that are not changes or additions or deletions may be discovered someday, then your comment is valid. Otherwise it simply perpetuates a wart that is trivially fixed as my patch demonstrates.


Add/Change #8359 (Adding a user in admin doesn't create a LogEntry for the addition)




Change Properties
Action