Introspection tools for Django
Project description
Django Introspection
Introspection tools for Django
Install
pip install django-introspection
Usage
from introspection import AppInspector
app = AppInspector("myapp_name")
# 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 inspect auth
# or for a model
python3 manage.py inspect 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for django-introspection-0.8.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ecbc59a48da0c3c781a072d3e7ac4ca1f67fdbb861e01b1ca92745a30b2d9fd |
|
MD5 | 9ec7074ebf42dbe1ededaec1a2e78f30 |
|
BLAKE2b-256 | a54d3cc33c9cbfa4a029ae734d29480b51862f752f8871d66aa9b731b013f890 |