
    ]j                     |    d dl mZmZ d dlmZ d dlmZmZ d dlm	Z	 d dl
mZ eed               Zeed               Zy)	    )HttpResponseBadRequestJsonResponse)render_to_string)require_show_toolbarsigned_data_view)HistoryStoreForm)DebugToolbarc                 @   t        |      }|j                         ry|j                  d   }t        j                  |      }i }|j
                  D ]9  }|j                  sd|i}t        d|      t        d|      d||j                  <   ; t        |      S t        d      S )z4Returns the selected debug toolbar history snapshot.store_idpanelz(debug_toolbar/includes/panel_button.htmlz)debug_toolbar/includes/panel_content.html)buttoncontentForm errors)r   is_validcleaned_datar	   fetchpanelsis_historicalr   panel_idr   r   )requestverified_dataformr   toolbarcontextr   panel_contexts           L/root/env/lib/python3.12/site-packages/debug_toolbar/panels/history/views.pyhistory_sidebarr   	   s     M*D}}$$Z0$$X.^^ 	E&&$e,M*> ,?	'GENN#		 G$$!-00    c                 *   t        |      }|j                         rng }t        t        j                  j                               D ]5  \  }}|j                  |t        d||t        d|i      dd      d       7 t        d|i      S t        d      S )	z?Returns the refreshed list of table rows for the History Panel.z$debug_toolbar/panels/history_tr.htmlr   )initial)r   r   )idstore_context)r!   r   requestsr   )
r   r   reversedr	   _storeitemsappendr   r   r   )r   r   r   r#   r!   r   s         r   history_refreshr(   #   s     M*D}}#L$7$7$=$=$?@ 	KBOO/>"$+2(8*bAQ(R.	 	" Z233!-00r   N)django.httpr   r   django.template.loaderr   debug_toolbar.decoratorsr   r   "debug_toolbar.panels.history.formsr   debug_toolbar.toolbarr	   r   r(    r   r   <module>r/      sL    < 3 K ? . 1  10 1  1r   