I use from django.contrib.auth.models import User
in Django for Authentication.
I want update 1 column of auth_user
table when any user login.
@login_required
def showMag(request):
return render(request,'index.html')
You could use user_logged_in signal
def login_additional_function(sender, user, request, **kwargs):
# user -> The user instance that just logged in.
user.changefield = field
user.save()
user_logged_in.connect(login_additional_function)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.