title: How do you add a model method to an existing class within an interactive session (in iPython)?
body: <p>I have a basic model:</p>
  
  <pre><code>class Person(models.Model):
      first_name = models.CharField(max_length=50)
      last_name = models.CharField(max_length=50)
      state = USStateField() 
  </code></pre>
  
  <p>I start up an iPython session with:</p>
  
  <pre><code>$ python manage.py shell
  &gt;&gt;&gt; from app.models import Person
  </code></pre>
  
  <p>How do I add this model method within the iPython session?</p>
  
  <pre><code>&gt;&gt;&gt;    def is_midwestern(self):  
  ...        "Returns True if this person is from the Midwest."  
  ...        return self.state in ('IL', 'WI', 'MI', 'IN', 'OH', 'IA', 'MO')  
  
  &gt;&gt;&gt; person = Person.objects.filter(last_name='Franklin')
  &gt;&gt;&gt; person.is_midwestern
  True
  </code></pre>
  
  <p>I want to be able to test these model methods without having to add the method to the models.py file and then restarting the iPython shell session.</p>
  
  <p>I seem to be doing something wrong because when I add a new model method in an interactive session, it doesn't seem to be linked to the class like it does when the model method is defined in a file. </p>
  
  <p>So if I created the model method as above and attempted to use it. 
  e.g. 
  ' >>> person = Person.objects.filter(last_name='Franklin')<br>
  <code>&gt;&gt;&gt; person.is_midwestern<br>
  'Person' object has no attribute</code>'is_midwestern'`</p>