When I enter the django shell, why does it 'freeze' the database
Question: Why does the database remain static when a user enters the django shell via
`python manage.py runserver`? For example:

    
    
    >>> from userprofile.models import UserProfile
    >>> up=UserProfile.objects.get(id=4)
    >>> up.get_jobs_applied_for()
    [<JobApplication: david - Editor>, <JobApplication: david - Assistant Director>]
    # delete entries in the mysql database
    >>> up.get_jobs_applied_for()
    [<JobApplication: david - Editor>, <JobApplication: david - Assistant Director>]
    # but the results do not reflect that
    

And the method being called:

    
    
    # in `UserProfile` class
    def get_jobs_applied_for(self):
        jobs_applied_for = self.jobapplication_set.order_by('-timestamp')
        return jobs_applied_for
    

Why doesn't it query the db in real-time?


Answer: As Matthew Schinckel asked, where and when does the deletion occur? If it
occurs in another process, before the second `>>> up.get_jobs_applied_for()`,
and you're using MySQL w/ isolation level set to [`REPEATABLE
READ`](http://dev.mysql.com/doc/refman/5.0/en/set-transaction.html), the MySQL
DB would provide you an earlier snapshot before the deletion. (Providing that
the code in your question are running in a whole transaction, for example in
managed transaction or on some MySQL connection pool)

Also, you could use `django.db.connection.queries` between lines to confirm
whether Django tries to query from DB actually.

