Django - Designing Model Relationships - Admin interface and Inline <p>I think my understanding of Django's FK and admin is a bit faulty, so I'd value any input on how to model the below case.</p> <p>Firstly, we have generic Address objects. Then, we have User's, who each have a UserProfile. Through this, Users belong to departments, as well as having addresses.</p> <p>Departments themselves can also have multiple addresses, as well as a head of department. So it might be something like (this is something I'm just hacking up now):</p> <pre><code>class Address(models.Model): street_address = models.CharField(max_length=20) etc... class Department(models.Model): name = models.CharField(max_lenght=20) head_of_department = models.OneToOneField(User) address = models.ForeignKey(Address) class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) address = models.ForeignKey(Address) department = models.OneToOneField(Department) </code></pre> <p>Anyhow, firstly, is that the right way of setting up the relationships?</p> <p>And secondly, I'd like it to appear in the admin that you can edit a department, and on that page, it'd have an inline list of all the addresses to also edit. I've tried setting up an AddressInline class, and attaching it as an inline to Department.</p> <pre><code>class AddressInline(admin.TabularInline): model = Address class DepartmentAdmin(admin.ModelAdmin): inlines = [AddressInline] </code></pre> <p>However, when I try to display that, I get:</p> <pre><code>Exception at /admin/people/department/1/ &lt;class 'people.models.Address'&gt; has no ForeignKey to &lt;class 'people.models.Department'&gt; </code></pre> <p>Cheers, Victor</p>