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
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
django-introspection-0.7.0.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for django-introspection-0.7.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ed8ef20b32261c80f93fc87188a462119980af80aa1a9d91b4cc4e9098c21fa |
|
MD5 | 09646efaab04abcd1712a5a4744f3c87 |
|
BLAKE2b-256 | 3f2f9ddc6cce126dec0e8415ea8a18abca8147130b2ec55903c8471d6cae44fd |
Close
Hashes for django_introspection-0.7.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8489352c443c20548fce394cb14f1d775b564198aae9bc4d9554769a6a22b633 |
|
MD5 | bacec31c9071228084fd8b35cbc4b923 |
|
BLAKE2b-256 | 74ec0a401bf03555b0feda7c0a06b8753437483e546891ec60615e0b3701bd16 |