title: Django Model Design
body: <p>I've previously asked questions for this project, regarding the Django Admin, Inlines, Generics, etc. Thanks again to the people who contributed answers to those. For background, those questions are here:</p>
  
  <p><a href="https://stackoverflow.com/questions/1918637/django-designing-model-relationships-admin-interface-and-inline">Django - Designing Model Relationships - Admin interface and Inline</a></p>
  
  <p><a href="https://stackoverflow.com/questions/2091156/django-generic-relations-with-django-admin">Django Generic Relations with Django Admin</a></p>
  
  <p>However, I think I should probably review my model again, to make sure it's actually "correct". So the focus here is on database design, I guess.</p>
  
  <p>We have a Django app with several objects - Users (who have a User Profile), Hospitals, Departments, Institutions (i.e. Education Institutions) - all of whom have multiple addresses (or no addresses). It's quite likely many of these will have multiple addresses.</p>
  
  <p>It's also possible that multiple object may have the same address, but this is rare, and I'm happy to have duplication for those instances where it occurs.</p>
  
  <p>Currently, the model is:</p>
  
  <pre><code>class Address(models.Model):
      street_address = models.CharField(max_length=50)
      suburb = models.CharField(max_length=20)
      state = models.CharField(max_length=3, choices=AUSTRALIAN_STATES_CHOICES)
      ...
      content_type = models.ForeignKey(ContentType)
      object_id = models.PositiveIntegerField()
      content_object = generic.GenericForeignKey()
      ...
  class Hospital(models.Model):
      name = models.CharField(max_length=20)
      address = generic.GenericRelation(Address)
      ...
  class UserProfile(models.Model):
      user = models.ForeignKey(User, unique=True)
      address = generic.GenericRelation(Address)
      ...
  </code></pre>
  
  <p>Firstly - am I doing it right, with the FK field on each object that has address(es)?</p>
  
  <p>Secondly, is there a better alternative to using Generic Relations for this case, where different objects all have addresses? In the other post, somebody mentioned using abstract classes - I thought of that, but there seems to be quite a bit of duplication there, since the addresses model is basically identical for all.</p>
  
  <p>Also, we'll be heavily using the Django admin, so it has to work with that, preferrably also with address as inlines.(That's where I was hitting an issue - because I was using generic relationships, the Django admin was expecting something in the content_type and object_id fields, and was erroring out when those were empty, instead of giving some kind of lookup).</p>
  
  <p>Cheers,
  Victor</p>