title: Django Database Design: Many-to-Many, Foreign Key, or neither?
body: <p>A noob question. I'm putting together my first database and have the following design problem: I have a class which defines a book (e.g. it's title) and a class which defines a page (e.g. it's design). </p>
  
  <p>The table for the class book would look so:</p>
  
  <pre><code>Title        | PAGE1        | PAGE2        | PAGE3
  Book-One     | SAMPLE1-UUID | SAMPLE2-UUID | SAMPLE3-UUID
  Book-Two     | SAMPLE4-UUID | SAMPLE5-UUID | SAMPLE6-UUID
  </code></pre>
  
  <p>The table for the class page:</p>
  
  <pre><code>UUID         | FONT         | CONTENTS etc.
  SAMPLE1-UUID | Times        | Example
  SAMPLE2-UUID | Arial        | Example Two
  SAMPLE3-UUID | Verdena      | Example Three
  </code></pre>
  
  <p>Now, as each page is unique and can't be re-used in another book, I can't use a many-to-many relationship for Pages. I could use Foreign-Key to link the two tables, i.e. link SAMPLE1-UUID of the Books Table with the SAMPLE1-UUID of the Pages Table. This has the advantage of not creating the same entry twice.</p>
  
  <p>However, I don't like the idea of having a fixed amount of rows for my pages. In the above example for the class Book, I'd have to define a certain set of Pages, like PAGE1, PAGE2, PAGE3, PAGE4, ... PAGE99. Ideally, all I need is a flexible list of pages for my book class, like so:</p>
  
  <pre><code>Name         | Pages
  Book-One     | "SAMPLE1-UUID, SAMPLE2-UUID"
  Book-Two     | "SAMPLE4-UUID, SAMPLE5-UUID, SAMPLE6-UUID"
  </code></pre>
  
  <p>Pages would be a simple CharField and its contents would be a list. But then I have the problem that the two tables are not linked anymore and that I'd have to create each entry twice (i.e. I would have to enter SAMPLE1-UUID in both the pages and books table).</p>
  
  <p>Is there another way to design this database? Thanks for any suggestion!</p>