Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
a88b308
Implement MQL panel for Django Debug Toolbar
aclark4life Feb 18, 2026
8328eda
Address review feedback
aclark4life Feb 25, 2026
a7c9ec7
Delete .coverage
timgraham Feb 27, 2026
4bade48
Address review feedback (🤖 assisted)
aclark4life Feb 27, 2026
86b57e1
Add tests based on sql panel tests (🤖 assisted)
aclark4life Mar 3, 2026
8423a65
Jib review fixes
aclark4life Mar 7, 2026
8885aa4
readme edits
aclark4life Mar 9, 2026
22ba13d
Update gitignore
aclark4life Mar 9, 2026
352bf3b
Address review feedback
aclark4life Mar 16, 2026
4de35fe
Remove find
aclark4life Mar 18, 2026
8186c5a
Fix convert_documents_to_table and add test
aclark4life Mar 18, 2026
a60193e
Address review feedback
aclark4life Mar 18, 2026
fc8cc25
Address review feedback
aclark4life Mar 24, 2026
b44209c
Add template_info support to MQL panel
aclark4life Mar 24, 2026
246f537
Address review feedback
aclark4life Mar 24, 2026
1f27725
Move template_info above stacktrace
aclark4life Mar 24, 2026
4777e75
More verbose test run output
aclark4life Mar 24, 2026
b58f94c
Add test coverage harness
aclark4life Mar 24, 2026
7c8508e
Rename select -> aggregate
aclark4life Mar 24, 2026
0a8e660
Fix package version resolution for coverage
aclark4life Mar 24, 2026
a6c71fd
Move utils tests from test_panel -> test_utils
aclark4life Mar 25, 2026
63bbdcd
Move forms tests from test_utils -> tests_forms
aclark4life Mar 25, 2026
48c9058
Add QueryPartsTests
aclark4life Mar 25, 2026
043fdf1
Rename mql select -> mql query
aclark4life Mar 26, 2026
f6b9dba
Address review feedback
aclark4life Mar 26, 2026
5b6a8e5
Move MQL panel tests to tests/debug_toolbar/
aclark4life Mar 26, 2026
fa11ab2
Rename debug_toolbar.panels.mql/* -> mql_panel/*
aclark4life Mar 26, 2026
5c3e9b7
Update readme
aclark4life Mar 26, 2026
048534f
Refactor mql form clean() method
aclark4life Mar 27, 2026
783a966
Address review feedback
aclark4life Mar 27, 2026
5b758c1
Format mql_query and fix dhtml pre-commit hook
aclark4life Mar 31, 2026
7bc42a9
Alpha-sort class methods
aclark4life Mar 31, 2026
40eef2d
Address review feedback
aclark4life Mar 31, 2026
0234ecb
Refactor tests
aclark4life Apr 1, 2026
66d97ac
Bump zizmorcore/zizmor-action from 0.5.0 to 0.5.2 in the actions grou…
dependabot[bot] Mar 18, 2026
2a685fb
Address review feedback
aclark4life Apr 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
with:
mongodb-version: ${{ env.MIN_MONGODB }}
mongodb-replica-set: test-rs
- name: Run unit tests with minimum dependency versions
- name: Run unit tests with minimum Python/MongoDB versions
run: |
uv sync --python=${MIN_PYTHON} --resolution=lowest-direct
uv sync --python=${MIN_PYTHON} --resolution=highest
just test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
__pycache__
uv.lock
.coverage
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,3 @@ repos:
hooks:
- id: djhtml
entry: djhtml --tabwidth 2
files: django_mongodb_extensions/templates/debug_toolbar/panels/mql.html
76 changes: 76 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,79 @@
# django-mongodb-extensions

Extensions for Django MongoDB Backend

## Installation

```bash
pip install django-mongodb-extensions
```

## Extensions

### MQL Panel

This panel for
[Django Debug Toolbar](https://github.com/jazzband/django-debug-toolbar)
provides insights into MongoDB queries executed during a request
similar to how the SQL panel works for relational databases.

**Features:**

- View all MongoDB queries (MQL) executed during a request
- See query execution time and identify slow queries
- Re-execute read operations (aggregate) directly from the toolbar
- Explain query execution plans
- Color-coded query grouping for easy identification
- Detailed query statistics and performance metrics

#### Configure the MQL Panel

First, install and configure Django Debug Toolbar by following their
[installation instructions](https://django-debug-toolbar.readthedocs.io/en/latest/installation.html).

1. **Add to `INSTALLED_APPS`** in your Django settings:

```python
INSTALLED_APPS = [
# ...
"django_mongodb_extensions",
# ...
]
```

2. **Add the MQL Panel** to your debug toolbar configuration:

```python
DEBUG_TOOLBAR_PANELS = [
"debug_toolbar.panels.history.HistoryPanel",
"debug_toolbar.panels.versions.VersionsPanel",
"debug_toolbar.panels.timer.TimerPanel",
"debug_toolbar.panels.settings.SettingsPanel",
"debug_toolbar.panels.headers.HeadersPanel",
"debug_toolbar.panels.request.RequestPanel",
# Add this:
"django_mongodb_extensions.mql_panel.MQLPanel",
"debug_toolbar.panels.templates.TemplatesPanel",
"debug_toolbar.panels.staticfiles.StaticFilesPanel",
"debug_toolbar.panels.cache.CachePanel",
"debug_toolbar.panels.signals.SignalsPanel",
"debug_toolbar.panels.redirects.RedirectsPanel",
"debug_toolbar.panels.profiling.ProfilingPanel",
]
```

3. **Optional:** Configure settings.

```python
# Maximum number of documents to return when re-executing select
# queries (default is 100).
DJDT_MQL_MAX_QUERY_RESULTS = 25

# Queries slower than this threshold (in milliseconds) are highlighted
# in the debug toolbar (default is 500 ms).
DJDT_MQL_WARNING_THRESHOLD = 1000
```

## License

See [LICENSE](LICENSE) file for details.
3 changes: 0 additions & 3 deletions django_mongodb_extensions/debug_toolbar/panels/__init__.py

This file was deleted.

This file was deleted.

63 changes: 0 additions & 63 deletions django_mongodb_extensions/debug_toolbar/panels/mql/panel.py

This file was deleted.

49 changes: 0 additions & 49 deletions django_mongodb_extensions/debug_toolbar/panels/mql/tracking.py

This file was deleted.

3 changes: 3 additions & 0 deletions django_mongodb_extensions/mql_panel/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from django_mongodb_extensions.mql_panel.panel import MQLPanel

__all__ = [MQLPanel.panel_id]
Comment thread
timgraham marked this conversation as resolved.
Loading
Loading