1๐
โ
I think you will need to use threadlocals to store the request
object, as it is not readily available in Django at the place where you need it.
Try this:
https://github.com/nebstrebor/django-threadlocals
from threadlocals.threadlocals import get_current_user
class SummaryAdmin(admin.ModelAdmin):
list_display = ('date', 'display_user', 'from_till', 'hours_worked',
'productivity_status',)
list_filter = ['date', 'user_crm']
def display_user(self, obj):
current_user = get_current_user()
...
๐คAnentropic
Source:stackexchange.com