title: Model not available during datamigration
body: <p>I have added a <code>Target</code> model in my app that tags a <code>Revision</code> object (from <code>django-reversion</code>) through a one-to-one field. The tag depends on the objects in the version set, and if any of these objects requires a tag, then the tag should be set for the entire revision. I am trying to use a <code>django-south</code> data migration to iterate through all the <code>Revision</code> objects in my database, check each object in the associated <code>version_set</code>, and set the tag if necessary.</p>
  
  <pre><code>class Migration(DataMigration):
  
      def forwards(self, orm):
          for revision in orm["reversion.Revision"].objects.all():
              try:
                  revision.target # the revision is already tagged
              except: # revision.target raises different sorts of DoesNotExist errors, 
                      # and I can't work out how to catch all of them
                  for version in revision.version_set.all():
                      try:
                          tag = version.object.get_tag() # all models in my app that   
                          orm.Target.objects.create(     # specify tags have this method
                                  revision=revision, 
                                  tag=tag)
                          break
                      except AttributeError: # the version set doesn't contain any
                          pass               # models that specify a tag
  </code></pre>
  
  <p>The gives an error:</p>
  
  <pre><code>    [... lots of stuff cut ...], line 21, in forwards
      for version in revision.version_set.all():
  AttributeError: 'Revision' object has no attribute 'version_set'
  </code></pre>
  
  <p>How can I get access to the <code>version_set</code> of a <code>Revision</code> object during a datamigration in a different app?</p>
  
  <p><strong>EDIT</strong> Thanks to Daniel I'm further along. In the following code I try to access all models via the Migration's own <code>orm</code>:</p>
  
  <pre><code>def forwards(self, orm):
      my_models = { # models with a .get_tag() method
              "modela": orm.ModelA,
              "modelb": orm.ModelB,
              }
      for revision in orm["reversion.Revision"].objects.all():
          for version in orm["reversion.Version"].objects.filter(revision=revision):
              try:
                  model = my_models[version.content_type.model]
                  instance = model.objects.get(id=version.object_id)
                  tag = instance.get_tag()
                  orm.RevisionTargetLanguage.objects.create(
                          revision=revision,
                          tag=tag)
                  break
              except KeyError: # not one of the models with a .get_tag() method
                  pass
  </code></pre>
  
  <p>This fails at the line <code>instance = model.objects.get(id=version.object_id_int)</code> with the exception <code>DoesNotExist: ModelB matching query does not exist</code>.</p>