File tree Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Expand file tree Collapse file tree 3 files changed +14
-5
lines changed Original file line number Diff line number Diff line change 19
19
} else {
20
20
$ ( '.djdt-panelContent' ) . hide ( ) ; // Hide any that are already open
21
21
var inner = current . find ( '.djDebugPanelContent .djdt-scroll' ) ,
22
- store_id = $ ( '#djDebug' ) . data ( 'store-id' ) ,
23
- render_panel_url = $ ( '#djDebug' ) . data ( 'render-panel-url' ) ;
24
- if ( store_id !== '' && inner . children ( ) . length === 0 ) {
22
+ store_id = $ ( '#djDebug' ) . data ( 'store-id' ) ;
23
+ if ( store_id && inner . children ( ) . length === 0 ) {
25
24
var ajax_data = {
26
25
data : {
27
26
store_id : store_id ,
28
27
panel_id : this . className
29
28
} ,
30
29
type : 'GET' ,
31
- url : render_panel_url
30
+ url : $ ( '#djDebug' ) . data ( 'render-panel-url' )
32
31
} ;
33
32
$ . ajax ( ajax_data ) . done ( function ( data ) {
34
33
inner . prev ( ) . remove ( ) ; // Remove AJAX loader
Original file line number Diff line number Diff line change 11
11
{% endif %}
12
12
< script src ="{% static 'debug_toolbar/js/toolbar.js' %} "> </ script >
13
13
< div id ="djDebug " class ="djdt-hidden " dir ="ltr "
14
- data-store-id ="{{ toolbar.store_id }} " data-render-panel-url ="{% url 'djdt:render_panel' %} "
14
+ {% if toolbar.store_id %}
15
+ data-store-id ="{{ toolbar.store_id }} "
16
+ data-render-panel-url ="{% url 'djdt:render_panel' %} "
17
+ {% endif %}
15
18
{{ toolbar.config.ROOT_TAG_EXTRA_ATTRS|safe }} >
16
19
< div class ="djdt-hidden " id ="djDebugToolbar ">
17
20
< ul id ="djDebugPanelList ">
Original file line number Diff line number Diff line change @@ -219,6 +219,13 @@ def test_sql_profile_checks_show_toolbar(self):
219
219
response = self .client .post (url , data , HTTP_X_REQUESTED_WITH = 'XMLHttpRequest' )
220
220
self .assertEqual (response .status_code , 404 )
221
221
222
+ @override_settings (DEBUG_TOOLBAR_CONFIG = {'RENDER_PANELS' : True })
223
+ def test_data_store_id_not_rendered_when_none (self ):
224
+ url = '/regular/basic/'
225
+ response = self .client .get (url )
226
+ self .assertIn (b'id="djDebug"' , response .content )
227
+ self .assertNotIn (b'data-store-id' , response .content )
228
+
222
229
223
230
@unittest .skipIf (webdriver is None , "selenium isn't installed" )
224
231
@unittest .skipUnless ('DJANGO_SELENIUM_TESTS' in os .environ , "selenium tests not requested" )
You can’t perform that action at this time.
0 commit comments