title: Need Contrains for Foreign Key
body: <p>I am creating a College Management App in Django.</p>
  <p>Here is my model. file: <code>accounts/model.py</code></p>
  <pre><code>from django.db import models
  from django.contrib.auth.models import AbstractUser
  
  class CustomUser(AbstractUser):
      ROLE = {('student', 'student'),
              ('staff', 'staff'),
              ('account_manager', 'account_manager'),
              ('Admin', 'Admin')}
      role = models.CharField(choices=ROLE, default='student',
                              max_length=20, blank=True, null=True)
  </code></pre>
  <p>I am using the inbuilt user class for all the users (staff, student, HOD and principal). We can identify the user by the role.</p>
  <p>No, I want to create a course database, where the staff_id will be the foreign key of <code>CustomUser</code> table. Is there any way to select the user with the role of the foreign key?</p>
  <pre><code>class Course(models.Model):
      course = models.CharField(max_length=150)
      start_date = models.DateField()
      end_date = models.DateField()
      instructor = models.ForeignKey(
          CustomUser, on_delete=models.CASCADE, related_name='instructor_name')
      examinar = models.ForeignKey(
          CustomUser, on_delete=models.CASCADE, related_name='examinar_name')
  
      def __str__(self):
          return f'{self.course.name} Batch No: {self.batch_no}'
  </code></pre>
  <p>Here both referring to the same <code>CustomUser</code> foreign key. That's why I have added the related name. (is this the right approach?)</p>
  <p>But on the admin page, if I want to add a new course, I am getting all the users. Like this:</p>
  <p><img src="https://i.stack.imgur.com/pxn6S.png" alt="enter image description here" />]<a href="https://i.stack.imgur.com/pxn6S.png" rel="nofollow noreferrer">1</a></p>
  <p>I want to display the users only if the role is staff. Is it possible?</p>