-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to register buttons below report from other apps
- Loading branch information
Showing
5 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from typing import Any, NamedTuple | ||
|
||
from django.http import HttpRequest | ||
|
||
|
||
class ReportPanelButton(NamedTuple): | ||
order: int | ||
template_name: str | ||
|
||
|
||
report_panel_buttons: list[ReportPanelButton] = [] | ||
|
||
|
||
def register_report_panel_button(order: int, template_name: str) -> None: | ||
global report_panel_buttons | ||
report_panel_buttons.append(ReportPanelButton(order, template_name)) | ||
report_panel_buttons = sorted(report_panel_buttons, key=lambda x: x.order) | ||
|
||
|
||
def base_context_processor(request: HttpRequest) -> dict[str, Any]: | ||
return { | ||
"report_panel_buttons": report_panel_buttons, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters