﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36555	Allow null for LogEntry.user	Siburg		"The `user` attribute of `LogEntry` is currently required. That causes two problems for me:
1. I have admin actions that can be performed by users as well as by periodically scheduled tasks (think Celery). For the latter case I now have to `get_or_create` a proxy user record for the `LogEntry` for that action. For example:
{{{
proxy_user, created = User.objects.get_or_create(
    username='DataScrubTask',
    defaults={'first_name': 'Proxy user for LogEntry records from ""archive_and_scrub_records"" task'},
)
}}}
2. When a user who took an admin action is deleted then the admin history is effectively corrupted. Because of the `CASCADE` for `LogEntry.user`, their actions are deleted from the history. 

To eliminate those problems I propose to add `blank=True, null=True` to the `user` field definition, and change `CASCADE` to `SET_NULL`.

To provide more flexibility for tracking actions, I also propose to add a `CharField` that can contain a text representation of who or what performed the action.

I have created a preliminary, incomplete PR [https://github.com/django/django/pull/19731] to show my proposed approach. I will gladly continue work on that if this proposal is accepted."	New feature	closed	contrib.admin	dev	Normal	wontfix		Siburg	Unreviewed	0	0	0	0	0	0
