Skip to main content

Django Introspection

Introspection tools for Django

Install

pip install django-introspection

Usage

from introspection import AppInspector

app = AppInspector("myapp_label") # note you can also use a path: django.contrib.auth
# get a list of app's models':
app.get_models()
print(app.models)
# get a list of fields for a model
fields = app.models[0].fields
print(fields)

Management command

Print details about a model or app:

# inspect an app
python3 manage.py inspectapp auth
# or python3 manage.py inspectapp django.contrib.auth

# for a model
python3 manage.py inspectmodel auth.User
# or python3 manage.py inspectmodel django.contrib.auth.User

Output:

========================================================
                  Fields
========================================================
# Found 14 fields: 
profile OneToOneField with related name user 
id AutoField 
password CharField 
last_login DateTimeField 
is_superuser BooleanField 
username CharField 
first_name CharField 
last_name CharField 
email CharField 
is_staff BooleanField 
is_active BooleanField 
date_joined DateTimeField 
groups ManyToManyField with related name user 
user_permissions ManyToManyField with related name user 
========================================================
                  Relations
========================================================
# Found 5 external relations : 
admin.LogEntry.user from auth.User.id ManyToOneRel  
account.EmailAddress.user from auth.User.id ManyToOneRel  
socialaccount.SocialAccount.user from auth.User.id ManyToOneRel  
reversion.Revision.user from auth.User.id ManyToOneRel  
polls.Vote.user from auth.User.id ManyToOneRel  
========================================================
                  Instances
========================================================
# Found 558 instances of User

Run the tests

Clone then cd in the django-introspection directory and run:

make install
make test-initial

Metadata

Release files for django-introspection 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-introspection 0.9.0
File Size Uploaded
django-introspection-0.9.0.tar.gz 7.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-introspection 0.9.0
File Interpreter ABI Platform
django_introspection-0.9.0-py3-none-any.whl Python 3 none any Details

Total release size: 17.6 kB

Release files / django-introspection-0.9.0.tar.gz

Download URL django-introspection-0.9.0.tar.gz
Size 7.5 kB
Tags Source
SHA-256 checksum
How to use checksums
fb45136e6d96c1af4b7e69011a50feff2754d1bc5bf7f9dde2d7e728460f00d2
BLAKE2b-256 checksum
How to use checksums
e8c23d2d724bff574b225badd1bdb5efb2b31b66991c16f97c17a5f4bae32320
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / django_introspection-0.9.0-py3-none-any.whl

Download URL django_introspection-0.9.0-py3-none-any.whl
Size 10.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e7e6b20b33bdfd0d692d61aa62d0641f941b7df02909be7b02acac77c8cd36f
BLAKE2b-256 checksum
How to use checksums
611c758724647e7060c117239e67f029e8ff6fa9474ec6164284016174efd7ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

0.9.0 This release

2 release files

0.8.2

1 release file

0.8.1

1 release file

0.8.0

1 release file

0.7.0

2 release files

0.6.0

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.4.6

1 release file

0.4.5

1 release file

0.4.4

1 release file

0.4.3

1 release file

0.4.1

1 release file

0.4

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page