How to get extended User custom fields in django template?
<p>I have extended django builtin user model. I am currently using django 1.10. </p>

<p>I am trying to display user name, short_name in template.
note: short_name is extended field</p>

<pre><code>&lt;span&gt; {{ request.user.profile.username  }} &lt;/span&gt;
&lt;span&gt; {{ user.profile.username  }} &lt;/span&gt;
{{ user.get_username }}
{{ user.username }}
</code></pre>

<p>this template tag is not working for django 1.10</p>

<p>I have used this link for creating custom user model <a href="https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html" rel="nofollow noreferrer">https://simpleisbetterthancomplex.com/tutorial/2016/07/22/how-to-extend-django-user-model.html</a></p>

<p>using this I would like to display role based content.</p>

<pre><code>class UserProfile(models.Model):
    user = models.ForeignKey(User, unique=True)

    employee_name = models.CharField(max_length=50)
    short_name = models.CharField(max_length=50)
    access = (
        ('admin', 'admin'),

        ('director', 'director'),
        ('management', 'management'),
        ('employee', 'employee'),
    )
    access_control = models.CharField(max_length=50, choices=access)
    YES_NO = (
        ('yes', 'Yes'),
        ('no', 'No'),
    )
    active = models.CharField(max_length=50, choices=YES_NO)
</code></pre>

<blockquote>
  <p>Added below lines in settings:</p>
</blockquote>

<pre><code>AUTH_PROFILE_MODULE = "user_login.UserProfile"

TEMPLATE_CONTEXT_PROCESSORS = (
    'django.core.context_processors.request',
"django.contrib.auth.context_processors.auth",
)

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, 'templates'), ],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
            ],
        },
    },
]
</code></pre>