当用户通过 django shell 进入时,为什么数据库保持静态python manage.py runserver
?例如:
>>> 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
被调用的方法:
# in `UserProfile` class
def get_jobs_applied_for(self):
jobs_applied_for = self.jobapplication_set.order_by('-timestamp')
return jobs_applied_for
为什么它不实时查询数据库?