title: Django: How to store certain objects of a model in another model
body: <p>I am currently trying to create a user profile that will contain the courses that the user chose. Currently, the user profile model is UserProfile and the courses are objects of Course. I've tried using the ManyToMany field but that just results in UserProfile storing all courses in Course.</p>
  <p>The two models are stored in different apps.</p>
  <p><strong>models.py</strong></p>
  <pre><code>class UserProfile(models.Model):
      user = models.OneToOneField(User, on_delete=models.CASCADE)
      image = models.ImageField(default=&quot;default.jpg&quot;, upload_to=&quot;profile_pics&quot;)
      courses = models.ManyToManyField(&quot;course.Course&quot;, blank=True, default=None, related_name = &quot;courses&quot;)
  
  
      def __str__(self):
          return f&quot;{self.user.username} Profile&quot;
  </code></pre>
  <p>Any help is appreciated. Thanks.</p>