Jonathan Richards Jonathan Richards - 5 months ago 10
Python Question

Finding Django source code based on import

I found a package extending the

models.BigIntegerField
in Django and I'm running into a bug with it, so I'm trying to look at the
BigIntegerField
's source code. Unfortunately the package imports
from django.db import models
and then calls
models.BigIntegerField
, but if I go to https://github.com/django/django, all /django/db/models is a folder, not a file, and I can't find BigIntegerField anywhere. Is there any way to actually figure out where stuff is in the source code?

Answer

You can search github repo, for example for a class definition.

When importing models Python looks for a file named models.py or for a models/__init__.py file if models is a directory. The latter file has a from django.db.models.fields import * line which import the BigIntegerField

Comments