mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-01 19:17:15 -04:00 
			
		
		
		
	Fix runtime warning when adding log entries
LogEntry.action_time expects a Django timezone object instead of a builtin datetime. This fixes a runtime warning of the following kind: RuntimeWarning: DateTimeField LogEntry.action_time received a naive datetime (2018-03-28 20:53:01.714173) while time zone support is active.
This commit is contained in:
		
							parent
							
								
									68251b8be6
								
							
						
					
					
						commit
						fcdcf62c2c
					
				| @ -6,8 +6,7 @@ from django.conf import settings | ||||
| from django.contrib.admin.models import ADDITION, LogEntry | ||||
| from django.contrib.auth.models import User | ||||
| from django.contrib.contenttypes.models import ContentType | ||||
| 
 | ||||
| from datetime import datetime | ||||
| from django.utils import timezone | ||||
| 
 | ||||
| from ..models import Correspondent, Document, Tag | ||||
| 
 | ||||
| @ -107,7 +106,7 @@ def set_log_entry(sender, document=None, logging_group=None, **kwargs): | ||||
| 
 | ||||
|     LogEntry.objects.create( | ||||
|         action_flag=ADDITION, | ||||
|         action_time=datetime.now(), | ||||
|         action_time=timezone.now(), | ||||
|         content_type=ct, | ||||
|         object_id=document.id, | ||||
|         user=user, | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user