title: Django - Create object and sub objects
body: <p>I have the following code:</p>
  
  <pre><code>class Album(models.Model):
    name = models.CharField(max_length=255, unique=True, null=False)
    rating = models.ForeignKey("Rating", null=False)
  
  class Rating(models.Model):
    value = models.IntegerField(null=False, default=0)
  </code></pre>
  
  <p>What is the best way (in the django/python philosophy) to create an object (Album) and it's sub object (Rating) and save it?</p>
  
  <p>I have done this:</p>
  
  <pre><code>a = Album()
  a.name = "..."
  r = Rating()
  r.save()
  a.rating = r
  a.save()
  </code></pre>
  
  <p>I don't like this because the part of creating the sub object empty is totally not useful.
  I'd prefer some simple way like this - the sub-object should be created automatically:</p>
  
  <pre><code>a = Album()
  a.name = "..."
  a.save()
  </code></pre>