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()
- [Django]-Modified Django admin clean() method not being invoked
- [Django]-Django Rest Framework Test case issue: 'HttpResponseNotAllowed' object has no attribute 'data'
- [Django]-Why does django parse tags in commented HTML code?
- [Django]-Write an Effective query for django for a FOR Loop?
- [Django]-ValueError: Couldn't load manifest 'staticfiles.json' (version 1.0)
Source:stackexchange.com