title: autodoc: base classes are shown with full name instead of respecting the import
body: <p>I hope I find a solution here for this quite intricate problem.</p>
  
  <p>I use sphinx and intersphinx to document my project.</p>
  
  <p>I have a class that inherits from mongoengine.Document.</p>
  
  <p>When I build sphinx docs using sphinx-apidoc and the sphinx-build (via the autogenerated Makefile by sphinx-quickstart), references to mongoengine.Document classes are shown as mongoengine.document.Document, which is actually the correct fully qualified name but this is a problem, because on mongoengine project that class is labelled as mongoengine.Document so intersphinx doesn't link at all.</p>
  
  <p>Is there a way to tell to sphinx to produce information on base classes as they are imported (in my code i have from mongoengine import Document) instead of its full module path?</p>
  
  <p>The following code:</p>
  
  <pre><code>from mongoengine import Document, EmbeddedDocumentListField
  
  class MyDocument(Document):
  """ my docstring """
  </code></pre>
  
  <p>it produces some html like:</p>
  
  <pre><code>class myproj.models.MyDocument(*args, **values) Bases:
  mongoengine.document.Document  &lt;-- intersphinx does not find the link to external doc!
  </code></pre>
  
  <p>instead of </p>
  
  <pre><code>class myproj.models.MyDocument(*args, **values)
  Bases: mongoengine.Document &lt;-- here intersphinx will properly link
  </code></pre>