-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Multi Report recursion error #3714
Changes from 3 commits
456714f
f772357
2375ad3
b2b944e
c5e2b39
47be0ba
7b1743a
37e23ab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
from datetime import datetime | ||
from typing import Any | ||
|
||
from django.contrib import messages | ||
from django.http import HttpRequest, HttpResponse | ||
from django.shortcuts import redirect | ||
from django.urls import reverse | ||
|
@@ -63,11 +62,6 @@ class OOISelectionMultiReportView(MultiReportStepsMixin, BreadcrumbsMultiReportV | |
current_step = 1 | ||
ooi_types = MultiOrganizationReport.input_ooi_types | ||
|
||
def get(self, request, *args, **kwargs): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed all |
||
if not self.get_ooi_selection(): | ||
messages.error(request, self.NONE_OOI_SELECTION_MESSAGE) | ||
return self.get(request, *args, **kwargs) | ||
|
||
|
||
class ReportTypesSelectionMultiReportView( | ||
MultiReportStepsMixin, BreadcrumbsMultiReportView, OOISelectionView, ReportTypeSelectionView | ||
|
@@ -81,12 +75,7 @@ class ReportTypesSelectionMultiReportView( | |
breadcrumbs_step = 4 | ||
current_step = 2 | ||
report_type = MultiOrganizationReport | ||
|
||
def get(self, request, *args, **kwargs): | ||
if not self.get_ooi_selection(): | ||
messages.error(request, self.NONE_OOI_SELECTION_MESSAGE) | ||
return redirect(self.get_previous()) | ||
return self.get(request, *args, **kwargs) | ||
ooi_types = MultiOrganizationReport.input_ooi_types | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooi_types must be present otherwise when selecting all oois it will fetch all ooi types. We want specific ooi types stored in the report types. I have refactor this part in #3705 which is done more efficiently in a get function. |
||
|
||
|
||
class SetupScanMultiReportView(MultiReportStepsMixin, BreadcrumbsMultiReportView, ReportPluginView): | ||
|
@@ -97,11 +86,7 @@ class SetupScanMultiReportView(MultiReportStepsMixin, BreadcrumbsMultiReportView | |
template_name = "generate_report/setup_scan.html" | ||
breadcrumbs_step = 5 | ||
current_step = 3 | ||
|
||
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: | ||
if self.all_plugins_enabled(): | ||
return redirect(self.get_next()) | ||
return super().get(request, *args, **kwargs) | ||
ooi_types = MultiOrganizationReport.input_ooi_types | ||
|
||
|
||
class ExportSetupMultiReportView(MultiReportStepsMixin, BreadcrumbsMultiReportView, ReportFinalSettingsView): | ||
|
@@ -113,13 +98,7 @@ class ExportSetupMultiReportView(MultiReportStepsMixin, BreadcrumbsMultiReportVi | |
breadcrumbs_step = 6 | ||
current_step = 4 | ||
report_type = MultiOrganizationReport | ||
|
||
def get(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: | ||
if not self.get_report_type_ids(): | ||
messages.error(request, self.NONE_REPORT_TYPE_SELECTION_MESSAGE) | ||
return redirect(self.get_previous()) | ||
|
||
return super().get(request, *args, **kwargs) | ||
ooi_types = MultiOrganizationReport.input_ooi_types | ||
|
||
|
||
class MultiReportView(BreadcrumbsMultiReportView, ReportPluginView): | ||
|
@@ -129,6 +108,7 @@ class MultiReportView(BreadcrumbsMultiReportView, ReportPluginView): | |
|
||
template_name = "multi_report.html" | ||
current_step = 5 | ||
ooi_types = MultiOrganizationReport.input_ooi_types | ||
|
||
def multi_reports_for_oois(self) -> dict[str, dict[str, Any]]: | ||
report = MultiOrganizationReport(self.octopoes_api_connector) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TemplateView is removed, it clashes with ListView from the BaseOOILIst. use it in specific views where needed.