Skip to main content

Tools for debugging Django, pprint models

Project description

Tools for debugging Django


  • dorm: Pretty print models, querysets, etc.
  • ds: Search dictionaries and lists for string.
  • ago: Generate datetimes.

DORM - Debug Django ORM

Pretty print django objects with syntax highlighting, column layout and shorthands.

Dorm can handle: - model instances + attribute coloring + grouping + attribute values + print in parallel columns - querysets + print all rows in queryset + prints selected values (in values=[] fashion) or value from ‘callable’ + paginate, with skipt to page - query + syntax highlight - list / dict / tuple through pprint


  • Python 2
  • Django
  • sqlparse


$ pip install djangodbu


Start Django shell_plus: python shell_plus

>>> from djangodbu import dorm
>>> dorm(MyModel.objects.get(id=123))
         instancemethod serializable_value
         instancemethod set_password
         instancemethod set_unusable_password
         instancemethod unique_error_message
         instancemethod validate_unique
                unicode USERNAME_FIELD: username
                unicode email:
                unicode first_name: Some
                unicode last_name: One
                unicode password: pbkdf2_sha256$20000$
                unicode username: someone
                   list REQUIRED_FIELDS: 1
                   long id: 357
                   long pk: 357 accountinguser: 651 > 'Some One'
         RelatedManager additionalemail_set: 1
         RelatedManager callback_set: 0
         RelatedManager campaigncode_set: 0
         RelatedManager grouplog: 142
     ManyRelatedManager groups: 0
         RelatedManager log: 379
         RelatedManager logevent_set: 89
         RelatedManager message_set: 11 payment: 510 > 'Bob & Uncle'
         RelatedManager settings_set: 1
         RelatedManager social_auth: 0
     ManyRelatedManager user_permissions: 0
         RelatedManager worker_set: 1
               NoneType activationcode
               NoneType auth_token
               NoneType employee
                   bool is_active: True
                   bool is_superuser: False
      datetime.datetime date_joined: 2016-05-01 08:13:16+00:00
      datetime.datetime last_login: 2016-06-20 07:48:51+00:00
                   type DoesNotExist: DoesNotExist
               classobj Meta: Meta
                   type MultipleObjectsReturned: MultipleObjectsReturned

Printing QuerySets:

>>> dorm(MyModel.objects.all())
1: userA
2: userB
4: userD
20: userY

Selecting values for QuerySet:

>>> dorm(User.objects.all(), v='first_name, email')

    id: firstname  email
    1: abcd
    2: efghij
    4: kl
    20: Mnopqrst

Print Query:

>>> dorm(User.objects.filter(email__isnull=False).exclude(first_name='kl').query)
       AND NOT (auth_user.first_name = kl))

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for djangodbu, version 0.1.1
Filename, size File type Python version Upload date Hashes
Filename, size djangodbu-0.1.1-py2-none-any.whl (23.7 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size djangodbu-0.1.1.tar.gz (24.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page