title: Django generic relations modelling
body: <p>I'm trying to model something in Django and it doesn't seem quite right. A <code>Book</code> and a <code>Movie</code> can have one or more <code>Person</code>s involved in it, each of whom has a <code>Role</code> (like "Author" or "Director") on that <code>Book</code> or <code>Movie</code>.</p>
  
  <p>I'm doing this with <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/contenttypes/#generic-relations" rel="nofollow noreferrer">Generic relations</a> something like this:</p>
  
  <pre><code>from django.contrib.contenttypes.fields import GenericForeignKey
  from django.contrib.contenttypes.models import ContentType
  from django.db import models
  
  class Person(models.Model):
      name = models.CharField(max_length=255)
  
  class Role(models.Model):
      person = models.ForeignKey('Person')
      role_name = models.CharField(max_length=255)
      content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
      object_id = models.PositiveIntegerField()
      content_object = GenericForeignKey('content_type', 'object_id')
  
  class Book(models.Model):
      title = models.CharField(max_length=255)
      roles = GenericRelation('Role', related_query_name='books')
  
  class Movie(models.Model):
      title = models.CharField(max_length=255)
      roles = GenericRelation('Role', related_query_name='movies')
  </code></pre>
  
  <p>Which seems to work, but it seems odd when getting all the <code>Book</code>s a <code>Person</code> has worked on:</p>
  
  <pre><code>person = Person.objects.get(pk=1)
  
  for role in person.role_set.all():
      print(role.role_name)
      for book in role.books.all():
          print(book.title)
  </code></pre>
  
  <p>The <code>for book in role.books.all()</code> feels wrong - like a role can have multiple books. I think I want a more direct relationship between a person working on a particular book/movie.</p>
  
  <p>Is there a better way to model this?</p>