1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
|
list_model_info
===============
:synopsis: Lists out all the fields and methods for models in installed apps.
Introduction
------------
When working with large projects or when returning to a code base after some time away, it can be challenging to remember all of the
fields and methods associated with your models. This command makes it easy to see:
* what fields are available
* how they are referred to in queries
* each field's class
* each field's representation in the database
* what methods are available
* method signatures
Commandline arguments
^^^^^^^^^^^^^^^^^^^^^
You can configure the output in a number of ways.
::
# Show each field's class
$ ./manage.py list_model_info --field-class
::
# Show each field's database type representation
$ ./manage.py list_model_info --db-type
::
# Show each method's signature
$ ./manage.py list_model_info --signature
::
# Show all model methods, including private methods and django's default methods
$ ./manage.py list_model_info --all-methods
::
# Output only information for a single model, specifying the app and model using dot notation
$ ./manage.py list_model_info --model users.User
You can combine arguments. for instance, to list all methods and show the method signatures for the User model within the users app::
$ ./manage.py list_model_info --all --signature --model users.User
Settings Configuration
^^^^^^^^^^^^^^^^^^^^^^
You can specify default values in your settings.py to simplify running this command.
.. tip::
Commandline arguments override the following settings, allowing you to change options on the fly.
To show each field's class::
MODEL_INFO_FIELD_CLASS = True
To show each field's database type representation::
MODEL_INFO_DB_TYPE = True
To show each method's signature::
MODEL_INFO_SIGNATURE = True
To show all model methods, including private methods and django's default methods::
MODEL_INFO_ALL_METHODS = True
To output only information for a single model, specify the app and model using dot notation::
MODEL_INFO_MODEL = 'users.User'
|