I have the following code:
from django.conf import settings
from django.db import models

class AccountManager(models.Model):
    account_manager = models.ForeignKey(
        settings.AUTH_USER_MODEL, on_delete=models.PROTECT, null=True, 
blank=True
    )

    class Meta:
        verbose_name = 'Account Manager'
        verbose_name_plural = 'Account Managers'

    def __str__(self):
        return str(self.account_manager)
The view for this, effectively a profile, is as follows

from django.contrib.auth import get_user_model
from django.shortcuts import render
from django.views.generic import DetailView
from django.contrib.auth.mixins import LoginRequiredMixin

from .models import AccountManager

User = get_user_model()


class AccountManagerDetailView(LoginRequiredMixin, DetailView):
    model = AccountManager
    template_name = "accountmanagers/dashboard.html" 
 
    def get_object(self, *args, **kwargs):
        return self.request.user

And the url:
urlpatterns = [
    path('detail/', views.AccountManagerDetailView.as_view(), 
name='accountmanagers'),
]
The template then shows the relevant user details but my problem is that I 
am stuck allocating the clients to the specific account manager. I know 
that I am missing the point in implementing a queryset and tieing it to 
that user.
Any help would be appreciated.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/87ede928-7459-4031-a7a2-9edf52f8bacan%40googlegroups.com.

Reply via email to