'Employee model Linked to Django User
I have the Django User model and I created Employee model as below
class Employee(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='employees')
title = models.CharField(_('Title'), max_length=6, default='Mr', choices=TITLE, blank=False, null=True)
firstname = models.CharField(_('Firstname'), max_length=125, null=False, blank=False)
In my sidebar.html I can access the username as {{ request.user }} but I want to show the title and firstname from the Employee model on the sidebar.html
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
