djangodbu


Namedjangodbu JSON
Version 0.1.8 PyPI version JSON
download
home_pageNone
SummaryTools for debugging Django ORM, pprint models
upload_time2024-11-12 11:29:06
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseNone
keywords debug django orm pprint shell_plus
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DjangoDBU
Tools for debugging Django

## Summary

- 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

## Requirements
- Python 2
- Django
- sqlparse

## Installation

    $ pip install djangodbu

## Usage

Start Django shell_plus: `python manage.py shell_plus`
```python
>>> 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: some.one@example.org
                 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
 so.mo.na.AccountingUser 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
        lo.pa.to.Payment 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:
```python
>>> dorm(MyModel.objects.all())
1: userA
2: userB
4: userD
20: userY
...
```
Selecting values for QuerySet:
```python
>>> dorm(User.objects.all(), v='first_name, email')

    id: firstname  email
------------------------------------------------
    1: abcd       userA@example.org
    2: efghij     userB@example.org
    4: kl         userD@example.org
    20: Mnopqrst  userY@example.org
...
```
Print Query:
```python
>>> dorm(User.objects.filter(email__isnull=False).exclude(first_name='kl').query)
```
```sql
SELECT auth_user.id,
       auth_user.password,
       auth_user.username,
       auth_user.first_name,
       auth_user.last_name,
       auth_user.email
FROM auth_user WHERE (auth_user.email IS NOT NULL
       AND NOT (auth_user.first_name = kl))
```

## DS - Dictionary search

'ds' accepts dictionaries and lists.

### Usage

```python
    >>> from djangodbu import ds
    >>> ds(haystack_dict, 'needle')
```

```python
    >>> from dbu.utils import ds

    >>> test = { 'a' : ['b', 'c'], 'd':3, 'e': { 'f':'g'}, 'h': 'i' }

    >>> ds(test, 'a')
    a: ['b', 'c']
    >>> ds(test, 'b')
    a > 0 : 'b'
    >>> ds(test, 'c')
    a > 1 : 'c'
    >>> ds(test, 'd')
    d: 3
    >>> ds(test, 'e')
    e: {'f': 'g'}
    >>> ds(test, 'f')
    e > f: 'g'
    >>> ds(test, 'g')
    e > f: 'g'
    >>> ds(test, 'h')
    h: 'i'
    >>> ds(test, 'i')
    h: 'i'
```


## Project url

[djangodbu on github](https://github.com/mulderns/djangodbu)

[djangodbu on pypi](https://pypi.python.org/pypi?name=djangodbu)

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "djangodbu",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "debug, django, orm, pprint, shell_plus",
    "author": null,
    "author_email": "Valtteri Kortesmaa <mulperns+please-remove-this-part-and-change-p-to-d@iki.fi>",
    "download_url": "https://files.pythonhosted.org/packages/07/63/d40c85e20a1fb1f2a1e3cb0063000b7f07bfc23b4e4e3db8ffe5540035b3/djangodbu-0.1.8.tar.gz",
    "platform": null,
    "description": "# DjangoDBU\nTools for debugging Django\n\n## Summary\n\n- dorm: Pretty print models, querysets, etc.\n- ds: Search dictionaries and lists for string.\n- ago: Generate datetimes.\n\n## DORM - Debug Django ORM\n\nPretty print django objects with syntax highlighting, column layout and shorthands.\n\nDorm can handle:\n- model instances\n    + attribute coloring + grouping\n    + attribute values\n    + print in parallel columns\n- querysets\n    + print all rows in queryset\n    + prints selected values (in values=[] fashion) or value from 'callable'\n    + paginate, with skipt to page\n- query\n    + syntax highlight\n- list / dict / tuple through pprint\n\n## Requirements\n- Python 2\n- Django\n- sqlparse\n\n## Installation\n\n    $ pip install djangodbu\n\n## Usage\n\nStart Django shell_plus: `python manage.py shell_plus`\n```python\n>>> from djangodbu import dorm\n>>> dorm(MyModel.objects.get(id=123))\n```\n```\n          instancemethod serializable_value\n          instancemethod set_password\n          instancemethod set_unusable_password\n          instancemethod unique_error_message\n          instancemethod validate_unique\n                 unicode USERNAME_FIELD: username\n                 unicode email: some.one@example.org\n                 unicode first_name: Some\n                 unicode last_name: One\n                 unicode password: pbkdf2_sha256$20000$\n                 unicode username: someone\n                    list REQUIRED_FIELDS: 1\n                    long id: 357\n                    long pk: 357\n so.mo.na.AccountingUser accountinguser: 651 > 'Some One'\n          RelatedManager additionalemail_set: 1\n          RelatedManager callback_set: 0\n          RelatedManager campaigncode_set: 0\n          RelatedManager grouplog: 142\n      ManyRelatedManager groups: 0\n          RelatedManager log: 379\n          RelatedManager logevent_set: 89\n          RelatedManager message_set: 11\n        lo.pa.to.Payment payment: 510 > 'Bob & Uncle'\n          RelatedManager settings_set: 1\n          RelatedManager social_auth: 0\n      ManyRelatedManager user_permissions: 0\n          RelatedManager worker_set: 1\n                NoneType activationcode\n                NoneType auth_token\n                NoneType employee\n                    bool is_active: True\n                    bool is_superuser: False\n       datetime.datetime date_joined: 2016-05-01 08:13:16+00:00\n       datetime.datetime last_login: 2016-06-20 07:48:51+00:00\n                    type DoesNotExist: DoesNotExist\n                classobj Meta: Meta\n                    type MultipleObjectsReturned: MultipleObjectsReturned\n```\n\nPrinting QuerySets:\n```python\n>>> dorm(MyModel.objects.all())\n1: userA\n2: userB\n4: userD\n20: userY\n...\n```\nSelecting values for QuerySet:\n```python\n>>> dorm(User.objects.all(), v='first_name, email')\n\n    id: firstname  email\n------------------------------------------------\n    1: abcd       userA@example.org\n    2: efghij     userB@example.org\n    4: kl         userD@example.org\n    20: Mnopqrst  userY@example.org\n...\n```\nPrint Query:\n```python\n>>> dorm(User.objects.filter(email__isnull=False).exclude(first_name='kl').query)\n```\n```sql\nSELECT auth_user.id,\n       auth_user.password,\n       auth_user.username,\n       auth_user.first_name,\n       auth_user.last_name,\n       auth_user.email\nFROM auth_user WHERE (auth_user.email IS NOT NULL\n       AND NOT (auth_user.first_name = kl))\n```\n\n## DS - Dictionary search\n\n'ds' accepts dictionaries and lists.\n\n### Usage\n\n```python\n    >>> from djangodbu import ds\n    >>> ds(haystack_dict, 'needle')\n```\n\n```python\n    >>> from dbu.utils import ds\n\n    >>> test = { 'a' : ['b', 'c'], 'd':3, 'e': { 'f':'g'}, 'h': 'i' }\n\n    >>> ds(test, 'a')\n    a: ['b', 'c']\n    >>> ds(test, 'b')\n    a > 0 : 'b'\n    >>> ds(test, 'c')\n    a > 1 : 'c'\n    >>> ds(test, 'd')\n    d: 3\n    >>> ds(test, 'e')\n    e: {'f': 'g'}\n    >>> ds(test, 'f')\n    e > f: 'g'\n    >>> ds(test, 'g')\n    e > f: 'g'\n    >>> ds(test, 'h')\n    h: 'i'\n    >>> ds(test, 'i')\n    h: 'i'\n```\n\n\n## Project url\n\n[djangodbu on github](https://github.com/mulderns/djangodbu)\n\n[djangodbu on pypi](https://pypi.python.org/pypi?name=djangodbu)\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Tools for debugging Django ORM, pprint models",
    "version": "0.1.8",
    "project_urls": {
        "Bug Tracker": "https://github.com/mulderns/djangodbu/issues",
        "Homepage": "https://github.com/mulderns/djangodbu"
    },
    "split_keywords": [
        "debug",
        " django",
        " orm",
        " pprint",
        " shell_plus"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "aeb06777efcaf101266ea397a8c1dd8eedc63c9e2d2162b8ee8c5ce65cd0d11f",
                "md5": "6b04579e4bc3d7f60bfdd57214762adb",
                "sha256": "1de688bb90208f5caf3035ef9601ec47bfbac35966afa35aba6732c12b43e94f"
            },
            "downloads": -1,
            "filename": "djangodbu-0.1.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b04579e4bc3d7f60bfdd57214762adb",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 36214,
            "upload_time": "2024-11-12T11:29:04",
            "upload_time_iso_8601": "2024-11-12T11:29:04.800807Z",
            "url": "https://files.pythonhosted.org/packages/ae/b0/6777efcaf101266ea397a8c1dd8eedc63c9e2d2162b8ee8c5ce65cd0d11f/djangodbu-0.1.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0763d40c85e20a1fb1f2a1e3cb0063000b7f07bfc23b4e4e3db8ffe5540035b3",
                "md5": "199840d2857b1500457e1d231fdd4b15",
                "sha256": "f622956bdcfe4e3fa121f155170d211117623fd9ec23eeaa91b2aef61ff9d888"
            },
            "downloads": -1,
            "filename": "djangodbu-0.1.8.tar.gz",
            "has_sig": false,
            "md5_digest": "199840d2857b1500457e1d231fdd4b15",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 37288,
            "upload_time": "2024-11-12T11:29:06",
            "upload_time_iso_8601": "2024-11-12T11:29:06.801612Z",
            "url": "https://files.pythonhosted.org/packages/07/63/d40c85e20a1fb1f2a1e3cb0063000b7f07bfc23b4e4e3db8ffe5540035b3/djangodbu-0.1.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-12 11:29:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mulderns",
    "github_project": "djangodbu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "djangodbu"
}
        
Elapsed time: 0.36918s