2021年1月2日星期六

How to change the user display name to their first name in Django

I am using the Django inbuilt user authentication system, from from django.contrib.auth.models import User. And I have realised that in the admin page it always displays the username of the user. Is it possible to change the def __str__ (self): method of that function to display a customized one, something like this.

def __str__ (self):      return f"{self.first_name}"  
https://stackoverflow.com/questions/65546636/how-to-change-the-user-display-name-to-their-first-name-in-django January 03, 2021 at 12:28PM

没有评论:

发表评论