title: django raises AttributeError when calling _set.all() for its child model
body: <p>I am currently imitating django official polls example to develop my own model like following:</p>
  <pre><code>from django.db import models
  
  class Instance(models.Model):
      inst_host = models.CharField(max_length=64)
      def __str__(self):
          return self.inst_host
  
  class RDMInfo(models.Model):
      instance = models.ForeignKey(Instance)
      filesystem = models.CharField(max_length=16)
      osdevice = models.CharField(max_length=16)
      lun_name = models.CharField(max_length=128)
      lun_id = models.IntegerField()
      wwn = models.CharField(max_length=128, unique=True)
      lun_size = models.CharField(max_length=8)
      def __str__(self):
          return '%s %s %s %s %s %s' % (self.filesystem, self.osdevice, self.lun_name, self.lun_id, self.wwn, self.lun_size)
  </code></pre>
  <p>and when I do following actions the error occurred:</p>
  <pre><code>&gt;&gt;&gt; from rdm.models import Instance, RDMInfo
  &gt;&gt;&gt; q = Instance.objects.get(pk=1)
  &gt;&gt;&gt; q
  &lt;Instance: alps_mtkalpsdbp1&gt;
  &gt;&gt;&gt; q.rdminfo_set.all()
  Traceback (most recent call last):
    File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;/usr/local/lib/python3.4/site-packages/Django-1.8.2-py3.4.egg/django/db/models/query.py&quot;, line 141, in __repr__
      return repr(data)
    File &quot;/usr/local/lib/python3.4/site-packages/Django-1.8.2-py3.4.egg/django/db/models/base.py&quot;, line 496, in __repr__
      u = six.text_type(self)
    File &quot;/home/oracle/jrlin/smc/rdm/models.py&quot;, line 17, in __str__
      return '%s %s %s %s %s %s' % (self.filesystem, self.osdevice, self.lun_name, self.lun_id, self.wwn, self.lun_size)
  AttributeError: 'RDMInfo' object has no attribute 'inst_host'
  </code></pre>
  <p>In the official example <a href="https://docs.djangoproject.com/en/1.8/intro/tutorial01/" rel="nofollow noreferrer">https://docs.djangoproject.com/en/1.8/intro/tutorial01/</a></p>
  <p>Its Question and Choice models work fine, and the structure of mine is almost identical to the example</p>
  <p>Does anyone know why the error raised? Thanks!</p>
  <blockquote>
  <p>Update</p>
  </blockquote>
  <p>I also configured the django admin as follows, will such action lead to the error?</p>
  <pre><code>from django.contrib import admin
  
  from .models import Instance, RDMInfo
  
  class RDMInline(admin.TabularInline):
      model = RDMInfo
      extra = 1
  
  class RDMAdmin(admin.ModelAdmin):
      fields = ['inst_host']
      inlines = [RDMInline]
  
  admin.site.register(Instance, RDMAdmin)
  </code></pre>
  <p><strong>Solved</strong></p>
  <p>Thanks for everyone's comment, it's my mistake, originally I typo and an unwanted attribute &quot;self.inst_host&quot; appears in the return command of the RDMInfo model, and after I remove it, I should execute migrate again and reopen the python shell. After doing migration and reopen the shell, it works find, thanks!</p>