django-devbar 0.6.0__tar.gz → 0.6.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: django-devbar
3
- Version: 0.6.0
3
+ Version: 0.6.1
4
4
  Summary: Lightweight performance devbar for Django
5
5
  Keywords: django,debug,performance,monitoring,development
6
6
  Author: amureki
@@ -71,16 +71,21 @@ uv add --dev django-devbar
71
71
  pip install django-devbar
72
72
  ```
73
73
 
74
- Add to your middleware as early as possible, but after any middleware that encodes the response (e.g., `GZipMiddleware`):
74
+ Add to your middleware early. For example:
75
75
 
76
76
  ```python
77
77
  MIDDLEWARE = [
78
78
  "django.middleware.security.SecurityMiddleware",
79
- "django_devbar.DevBarMiddleware",
80
79
  # ...
81
80
  ]
81
+
82
+ if DEBUG:
83
+ idx = MIDDLEWARE.index("django.middleware.security.SecurityMiddleware")
84
+ MIDDLEWARE.insert(idx + 1, "django_devbar.DevBarMiddleware")
82
85
  ```
83
86
 
87
+ This keeps the middleware active only in development and avoids import errors if the package isn't installed in production.
88
+
84
89
  ## Configuration
85
90
 
86
91
  All settings are optional. Configure via a `DEVBAR` dict in your Django settings:
@@ -40,16 +40,21 @@ uv add --dev django-devbar
40
40
  pip install django-devbar
41
41
  ```
42
42
 
43
- Add to your middleware as early as possible, but after any middleware that encodes the response (e.g., `GZipMiddleware`):
43
+ Add to your middleware early. For example:
44
44
 
45
45
  ```python
46
46
  MIDDLEWARE = [
47
47
  "django.middleware.security.SecurityMiddleware",
48
- "django_devbar.DevBarMiddleware",
49
48
  # ...
50
49
  ]
50
+
51
+ if DEBUG:
52
+ idx = MIDDLEWARE.index("django.middleware.security.SecurityMiddleware")
53
+ MIDDLEWARE.insert(idx + 1, "django_devbar.DevBarMiddleware")
51
54
  ```
52
55
 
56
+ This keeps the middleware active only in development and avoids import errors if the package isn't installed in production.
57
+
53
58
  ## Configuration
54
59
 
55
60
  All settings are optional. Configure via a `DEVBAR` dict in your Django settings:
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "django-devbar"
3
- version = "0.6.0"
3
+ version = "0.6.1"
4
4
  description = "Lightweight performance devbar for Django"
5
5
  readme = "README.md"
6
6
  license = "MIT"
@@ -85,7 +85,7 @@ def _record(sql, params, duration):
85
85
  query_log = _query_log.get()
86
86
  query_log.append(
87
87
  {
88
- "sql": sql,
88
+ "sql": str(sql),
89
89
  "duration": round(duration, 2),
90
90
  "params_hash": params_hash,
91
91
  }