Code

Opened 6 years ago

Closed 6 years ago

Last modified 3 years ago

#8359 closed (fixed)

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

Reported by: evan_schulz Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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 (2)

8359.diff (637 bytes) - added by evan_schulz 6 years ago.
8359choices.diff (1.8 KB) - added by rockmhoward@… 6 years ago.
Optional additional patch to fix object history display.

Download all attachments as: .zip

Change History (10)

Changed 6 years ago by evan_schulz

comment:1 Changed 6 years ago by Alex

  • milestone set to 1.0
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:2 Changed 6 years ago by mtredinnick

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

comment:3 Changed 6 years ago by evan_schulz

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

Changed 6 years ago by rockmhoward@…

Optional additional patch to fix object history display.

comment:4 Changed 6 years ago by rockmhoward@…

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.

comment:5 follow-up: Changed 6 years ago 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.

comment:6 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:7 in reply to: ↑ 5 Changed 6 years ago by rockmhoward@…

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.

comment:8 Changed 3 years ago by jacob

  • milestone 1.0 deleted

Milestone 1.0 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.