[Django]-How to get currently logged in user in django model on post_save signals?

0👍

To complement Altaisoft’s answer : you have to understand that models are not dependent on HTTP requests and can be created / updated / deleted in a Python script (guess what ./manage.py loaddata do ?), a Python shell, whatever, so there’s not necessarily a “logged in user”.

3👍

Why not fill this data in your view?

def my_view(request):
    my_instance = Event.objects.get(pk=...)
    # Fill your instance data, for example, from a submitted form
    my_instance.submitted_by = request.user
    my_instance.save()

Leave a comment