title: Check if a User type exists in ManyToManyField in Django?
body: <p>I have a Course Model which contains a user who creates the course and contains a <code>enrolled</code> ManyToManyField which lets users enroll in the course.</p>
  <pre class="lang-py prettyprint-override"><code>class Course(models.Model):
      id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
      user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='course_owner')
      enrolled = models.ManyToManyField(User)
      ...
  </code></pre>
  <p>The user model contains two types - Teacher (Created the course) and Student (enrolls)</p>
  <pre class="lang-py prettyprint-override"><code>class User(AbstractUser):
      is_student = models.BooleanField(default=True)
      is_teacher = models.BooleanField(default=False)
  </code></pre>
  <p>I want a MyCourses View where the teacher can view his created_courses and the student can view his enrolled courses.</p>
  <pre class="lang-py prettyprint-override"><code>def MyCourses(request):
      user = request.user
      courses = Course.objects.filter(user=user)
  
      context = {
          'courses': courses
      }
  
      return render(request, 'classroom/mycourses.html', context)
  </code></pre>
  <p>This works for the teacher part but how I can check if a student is enrolled in the course?</p>
  <p>Thanks.</p>