home / django_tickets / tickets

tickets: 8248

This data as json

id created changetime last_pulled_from_trac stage status component type severity version resolution summary description owner reporter keywords easy has_patch needs_better_patch needs_tests needs_docs ui_ux
8248 2008-08-12 03:46:06 2009-02-25 19:51:44 2022-03-06 03:41:45.211828 Accepted closed Core (Other)     dev fixed Built-in python function, help(), does not work on models with ForeignKey fields If a model refers to a Site model, the help() function stops working, meaning functions, docstrings, etc don't print. To reproduce: {{{ $ django-admin.py startproject myproj $ ./manage.py shell >>> from django.contrib.sites.models import Site >>> help(Site) }}} This will return correct functions, docstrings, etc... Now create an app: {{{ $ ./manage.py startapp myapp }}} Create a model: {{{ from django.db import models from django.contrib.sites.models import Site class MyModel(models.Model): name = models.CharField(max_length=50) site = models.ForeignKey(Site) }}} Now try to view help for this either MyModel or Site: {{{ $ ./manage.py shell >>> from myapp.models import MyModel >>> from django.contrib.sites.models import Site >>> help(MyModel) >>> help(Site) }}} Both calls will only show something similar to: {{{ Help on class MyModel in module myproj.myapp.models: MyModel = <class 'myproj.myapp.models.MyModel'> (END) }}} Tested on SVN 8204 and 8313 - same results   lingrlongr help ForeignKey foreign key 0 0 0 0 0 0
Powered by Datasette · Queries took 2.029ms