(self)
| 28 | return value |
| 29 | |
| 30 | def clean(self): |
| 31 | from debug_toolbar.panels.sql import SQLPanel |
| 32 | |
| 33 | cleaned_data = super().clean() |
| 34 | toolbar = DebugToolbar.fetch( |
| 35 | self.cleaned_data["request_id"], panel_id=SQLPanel.panel_id |
| 36 | ) |
| 37 | if toolbar is None: |
| 38 | raise ValidationError(_("Data for this panel isn't available anymore.")) |
| 39 | |
| 40 | panel = toolbar.get_panel_by_id(SQLPanel.panel_id) |
| 41 | # Find the query for this form submission |
| 42 | query = None |
| 43 | for q in panel.get_stats()["queries"]: |
| 44 | if q["djdt_query_id"] != self.cleaned_data["djdt_query_id"]: |
| 45 | continue |
| 46 | else: |
| 47 | query = q |
| 48 | break |
| 49 | if not query: |
| 50 | raise ValidationError(_("Invalid query id.")) |
| 51 | cleaned_data["query"] = query |
| 52 | return cleaned_data |
| 53 | |
| 54 | def _render_row(self, row): |
| 55 | return tuple( |
nothing calls this directly
no test coverage detected