I am trying to extend the user model in django by using a Client model (this might not be the ideal way, but that boat has sailed). When I try to access a user record in a template I get the error:
No Client matches the given query
models.py
class Client(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
views.py
def update_client_details(request):
if request.user.is_authenticated:
user = request.user
# print('pk', user.pk)
client = get_object_or_404(Client, pk=user.pk)
If I print the user.pk I see what I expect.
Why doesn't it return an object?