If you have a profile model configured as suggested by Django , you can specify the full name on this model
from django.contrib.auth.models import User class UserProfile(models.Model): user = models.OneToOneField(User) ... @property def full_name(self): return "%s %s" % (self.user.first_name, self.user.last_name)
then anywhere you have access to the user object, which you can easily do user.get_profile.full_name
Alternatively, if you only need the full name in the template, you can write a simple tag:
@register.simple_tag def fullname(user): return "%s %s" % (user.first_name, user.last_name)
source share