wbreport 1.50.14__tar.gz → 1.58.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {wbreport-1.50.14 → wbreport-1.58.3}/PKG-INFO +1 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/factsheets/base.py +5 -5
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/factsheets/multitheme.py +5 -5
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/models.py +6 -2
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/charts/legend.py +1 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/charts/pie.py +1 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/charts/timeseries.py +1 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/flowables/risk.py +2 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/flowables/textboxes.py +2 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/basic_factsheet.py +11 -10
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/fund_factsheet.py +10 -9
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/long_industry_exposure_factsheet.py +10 -9
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/multistrat_factsheet.py +7 -6
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/tables/aggregated_tables.py +4 -3
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/tables/data_tables.py +2 -1
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/test_models.py +1 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/test_tasks.py +1 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/displays.py +1 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/endpoints.py +3 -10
- {wbreport-1.50.14 → wbreport-1.58.3}/.gitignore +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/LICENSE +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/pyproject.toml +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/admin.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/apps.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/factsheets/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/factsheets/menu.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/defaults/factsheets/mixins.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/dynamic_preferences_registry.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/factories/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/factories/data_classes.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/factories/reports.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/filters.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/fixtures/wbreport.yaml +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0001_initial_squashed_squashed_0007_report_key.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0008_alter_report_file_content_type.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0009_alter_report_color_palette.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0010_auto_20240103_0947.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0011_auto_20240207_1629.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0012_reportversion_lock.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0013_alter_reportversion_context.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0014_alter_reportcategory_options_and_more.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/mixins.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/charts/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/flowables/themes.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/run.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/sandbox/templates/testfile.pdf +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/pdf/tables/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/serializers.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tasks.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/templates/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/templatetags/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/templatetags/portfolio_tags.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/conftest.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/test_viewsets.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/tests/tests.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/urls.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/urls_public.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/__init__.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/buttons.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/menus.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/configs/titles.py +0 -0
- {wbreport-1.50.14 → wbreport-1.58.3}/wbreport/viewsets/viewsets.py +0 -0
|
@@ -22,7 +22,6 @@ from reportlab.platypus import (
|
|
|
22
22
|
Flowable,
|
|
23
23
|
NextPageTemplate,
|
|
24
24
|
PageTemplate,
|
|
25
|
-
Paragraph,
|
|
26
25
|
Spacer,
|
|
27
26
|
Table,
|
|
28
27
|
TableStyle,
|
|
@@ -33,6 +32,7 @@ from wbcore.utils.figures import (
|
|
|
33
32
|
get_horizontal_barplot,
|
|
34
33
|
get_piechart,
|
|
35
34
|
)
|
|
35
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
36
36
|
from wbportfolio.models.products import InvestmentIndex
|
|
37
37
|
|
|
38
38
|
from wbreport.mixins import ReportMixin
|
|
@@ -199,7 +199,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
199
199
|
return template.render(context)
|
|
200
200
|
|
|
201
201
|
@classmethod
|
|
202
|
-
def generate_file(cls, context):
|
|
202
|
+
def generate_file(cls, context): # noqa: C901
|
|
203
203
|
debug = False
|
|
204
204
|
# Product Data
|
|
205
205
|
# Main Feature table as dictionary
|
|
@@ -446,7 +446,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
446
446
|
# Price Timeseries Chart
|
|
447
447
|
elements.append(
|
|
448
448
|
get_timeseries_chart(
|
|
449
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
449
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
450
450
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
451
451
|
height=4.34 * cm,
|
|
452
452
|
color=c_product,
|
|
@@ -467,7 +467,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
467
467
|
"<strong>Top 3 Contributors</strong>",
|
|
468
468
|
"<strong>Bottom 3 Contributors</strong>",
|
|
469
469
|
],
|
|
470
|
-
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors)),
|
|
470
|
+
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors, strict=False)),
|
|
471
471
|
width=CONTENT_WIDTH_PAGE1_LEFT,
|
|
472
472
|
header_row_height=0.85 * cm,
|
|
473
473
|
data_row_height=0.39 * cm,
|
|
@@ -636,7 +636,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
636
636
|
|
|
637
637
|
data = list()
|
|
638
638
|
categories = list()
|
|
639
|
-
for
|
|
639
|
+
for row in df.itertuples():
|
|
640
640
|
data.append(row.weighting * 100)
|
|
641
641
|
categories.append(f"{row.aggregated_title} ({row.weighting * 100:.1f}%)")
|
|
642
642
|
|
|
@@ -21,7 +21,6 @@ from reportlab.platypus import (
|
|
|
21
21
|
BaseDocTemplate,
|
|
22
22
|
NextPageTemplate,
|
|
23
23
|
PageTemplate,
|
|
24
|
-
Paragraph,
|
|
25
24
|
Spacer,
|
|
26
25
|
Table,
|
|
27
26
|
TableStyle,
|
|
@@ -32,6 +31,7 @@ from wbcore.utils.figures import (
|
|
|
32
31
|
get_horizontal_barplot,
|
|
33
32
|
get_piechart,
|
|
34
33
|
)
|
|
34
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
35
35
|
from wbportfolio.models.products import InvestmentIndex
|
|
36
36
|
|
|
37
37
|
from wbreport.mixins import ReportMixin
|
|
@@ -199,7 +199,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
199
199
|
return template.render(context)
|
|
200
200
|
|
|
201
201
|
@classmethod
|
|
202
|
-
def generate_file(cls, context):
|
|
202
|
+
def generate_file(cls, context): # noqa: C901
|
|
203
203
|
debug = False
|
|
204
204
|
|
|
205
205
|
main_features_dict = context["information_table"]["Main Features"]
|
|
@@ -450,7 +450,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
450
450
|
# Price Timeseries Chart
|
|
451
451
|
elements.append(
|
|
452
452
|
get_timeseries_chart(
|
|
453
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
453
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
454
454
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
455
455
|
height=4.34 * cm,
|
|
456
456
|
color=c_product,
|
|
@@ -471,7 +471,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
471
471
|
"<strong>Top 3 Contributors</strong>",
|
|
472
472
|
"<strong>Bottom 3 Contributors</strong>",
|
|
473
473
|
],
|
|
474
|
-
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors)),
|
|
474
|
+
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors, strict=False)),
|
|
475
475
|
width=CONTENT_WIDTH_PAGE1_LEFT,
|
|
476
476
|
header_row_height=0.85 * cm,
|
|
477
477
|
data_row_height=0.39 * cm,
|
|
@@ -639,7 +639,7 @@ class ReportClass(FactsheetReportMixin, ReportMixin):
|
|
|
639
639
|
|
|
640
640
|
data = list()
|
|
641
641
|
categories = list()
|
|
642
|
-
for
|
|
642
|
+
for row in df.itertuples:
|
|
643
643
|
data.append(row.weighting * 100)
|
|
644
644
|
categories.append(f"{row.aggregated_title} ({row.weighting * 100:.1f}%)")
|
|
645
645
|
|
|
@@ -112,9 +112,9 @@ class ReportClass(WBModel):
|
|
|
112
112
|
"""
|
|
113
113
|
if (len(args) == 3 and (class_path := args[2])) or (class_path := kwargs.get("class_path", None)):
|
|
114
114
|
try:
|
|
115
|
-
if
|
|
115
|
+
if class_module := getattr(importlib.import_module(class_path), "ReportClass", None):
|
|
116
116
|
for method in self.REPORT_CLASS_DEFAULT_METHODS:
|
|
117
|
-
setattr(self, method, getattr(
|
|
117
|
+
setattr(self, method, getattr(class_module, method))
|
|
118
118
|
except ModuleNotFoundError:
|
|
119
119
|
for method in self.REPORT_CLASS_DEFAULT_METHODS:
|
|
120
120
|
setattr(self, method, lambda *a, **k: None)
|
|
@@ -674,6 +674,10 @@ class ReportVersion(models.Model):
|
|
|
674
674
|
mass_mail.send()
|
|
675
675
|
mass_mail.save()
|
|
676
676
|
|
|
677
|
+
@classmethod
|
|
678
|
+
def get_endpoint_basename(cls) -> str:
|
|
679
|
+
return "wbreport:reportversion"
|
|
680
|
+
|
|
677
681
|
@classmethod
|
|
678
682
|
def get_representation_endpoint(cls) -> str:
|
|
679
683
|
return "wbreport:reportversionrepresentation-list"
|
|
@@ -4,7 +4,7 @@ from reportlab.lib.colors import transparent
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class CustomLegend(Legend):
|
|
7
|
-
def _defaultSwatch(self, x, thisy, dx, dy, fillColor, strokeWidth, strokeColor):
|
|
7
|
+
def _defaultSwatch(self, x, thisy, dx, dy, fillColor, strokeWidth, strokeColor): # noqa: N803, N802
|
|
8
8
|
return Circle(
|
|
9
9
|
x,
|
|
10
10
|
thisy + dx / 2,
|
|
@@ -17,7 +17,7 @@ class LogScaleTimeSeriesPlot(LinePlot):
|
|
|
17
17
|
super().__init__()
|
|
18
18
|
|
|
19
19
|
class CustomYAxis(LogYValueAxis):
|
|
20
|
-
def _calcTickPositions(self):
|
|
20
|
+
def _calcTickPositions(self): # noqa: N802
|
|
21
21
|
return self._calcStepAndTickPositions()[1]
|
|
22
22
|
|
|
23
23
|
self.xValueAxis = NormalDateXValueAxis()
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
from reportlab.lib.colors import HexColor, black, white
|
|
2
2
|
from reportlab.lib.units import cm
|
|
3
3
|
from reportlab.pdfbase.pdfmetrics import stringWidth
|
|
4
|
-
from reportlab.platypus import Flowable
|
|
4
|
+
from reportlab.platypus import Flowable
|
|
5
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
class RiskScale(Flowable):
|
|
@@ -2,8 +2,9 @@ from reportlab.graphics import renderPDF
|
|
|
2
2
|
from reportlab.lib.colors import black
|
|
3
3
|
from reportlab.lib.units import cm
|
|
4
4
|
from reportlab.pdfbase.pdfmetrics import stringWidth
|
|
5
|
-
from reportlab.platypus import Flowable, Image,
|
|
5
|
+
from reportlab.platypus import Flowable, Image, Table, TableStyle
|
|
6
6
|
from svglib.svglib import svg2rlg
|
|
7
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class TextBox(Flowable):
|
|
@@ -22,7 +22,6 @@ from reportlab.platypus import (
|
|
|
22
22
|
Image,
|
|
23
23
|
NextPageTemplate,
|
|
24
24
|
PageTemplate,
|
|
25
|
-
Paragraph,
|
|
26
25
|
Spacer,
|
|
27
26
|
Table,
|
|
28
27
|
TableStyle,
|
|
@@ -30,6 +29,8 @@ from reportlab.platypus import (
|
|
|
30
29
|
from reportlab.platypus.flowables import KeepTogether, TopPadder
|
|
31
30
|
from reportlab.platypus.frames import Frame
|
|
32
31
|
from svglib.svglib import svg2rlg
|
|
32
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
33
|
+
|
|
33
34
|
from wbreport.models import ReportAsset
|
|
34
35
|
from wbreport.pdf.charts.pie import (
|
|
35
36
|
get_pie_chart_horizontal,
|
|
@@ -43,7 +44,7 @@ from wbreport.pdf.tables.aggregated_tables import get_simple_aggregated_table
|
|
|
43
44
|
from wbreport.pdf.tables.data_tables import get_simple_data_table
|
|
44
45
|
|
|
45
46
|
|
|
46
|
-
def generate_report(context):
|
|
47
|
+
def generate_report(context): # noqa: C901
|
|
47
48
|
debug = False
|
|
48
49
|
### Product Data ###
|
|
49
50
|
# Main Feature table as dictionary
|
|
@@ -121,7 +122,7 @@ def generate_report(context):
|
|
|
121
122
|
s_base_small_justified = ParagraphStyle(
|
|
122
123
|
name="s_base_small_justified", parent=s_base, fontSize=6.5, leading=7, alignment=TA_JUSTIFY
|
|
123
124
|
)
|
|
124
|
-
s_base_small_justified_indent = ParagraphStyle(
|
|
125
|
+
s_base_small_justified_indent = ParagraphStyle( # noqa: F841
|
|
125
126
|
name="s_base_small_justified_indent", parent=s_base_small_justified, leftIndent=CONTENT_OFFSET
|
|
126
127
|
)
|
|
127
128
|
s_base_indent = ParagraphStyle(name="s_description", parent=s_base, spaceBefore=8, leftIndent=CONTENT_OFFSET)
|
|
@@ -135,7 +136,7 @@ def generate_report(context):
|
|
|
135
136
|
s_table_medium_leading = ParagraphStyle(name="s_table_medium_leading", parent=s_table_medium, leading=13.9)
|
|
136
137
|
s_table_large = ParagraphStyle(name="s_table_large", parent=s_table_medium, fontSize=11, leading=11)
|
|
137
138
|
s_table_large_center = ParagraphStyle(name="s_table_large", parent=s_table_large, alignment=TA_CENTER)
|
|
138
|
-
s_table_large_center_padding = ParagraphStyle(
|
|
139
|
+
s_table_large_center_padding = ParagraphStyle( # noqa: F841
|
|
139
140
|
name="s_table_large", parent=s_table_large_center, spaceBefore=20, spaceAfter=20
|
|
140
141
|
)
|
|
141
142
|
s_table_center = ParagraphStyle(
|
|
@@ -278,7 +279,7 @@ def generate_report(context):
|
|
|
278
279
|
)
|
|
279
280
|
return title_table
|
|
280
281
|
|
|
281
|
-
def impress(
|
|
282
|
+
def impress(elements):
|
|
282
283
|
style = s_table_headline_2
|
|
283
284
|
table_data = [
|
|
284
285
|
[
|
|
@@ -306,7 +307,7 @@ def generate_report(context):
|
|
|
306
307
|
]
|
|
307
308
|
)
|
|
308
309
|
)
|
|
309
|
-
|
|
310
|
+
elements.append(KeepTogether(TopPadder(t)))
|
|
310
311
|
|
|
311
312
|
# Description
|
|
312
313
|
elements.append(generate_title(general_data["title"]))
|
|
@@ -334,7 +335,7 @@ def generate_report(context):
|
|
|
334
335
|
# Price Timeseries Chart
|
|
335
336
|
elements.append(
|
|
336
337
|
get_timeseries_chart(
|
|
337
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
338
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
338
339
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
339
340
|
height=4.34 * cm,
|
|
340
341
|
color=c_product,
|
|
@@ -355,7 +356,7 @@ def generate_report(context):
|
|
|
355
356
|
"<strong>Top 3 Contributors</strong>",
|
|
356
357
|
"<strong>Bottom 3 Contributors</strong>",
|
|
357
358
|
],
|
|
358
|
-
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors)),
|
|
359
|
+
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors, strict=False)),
|
|
359
360
|
width=CONTENT_WIDTH_PAGE1_LEFT,
|
|
360
361
|
header_row_height=0.85 * cm,
|
|
361
362
|
data_row_height=0.39 * cm,
|
|
@@ -557,7 +558,7 @@ def generate_report(context):
|
|
|
557
558
|
|
|
558
559
|
data = list()
|
|
559
560
|
categories = list()
|
|
560
|
-
for
|
|
561
|
+
for row in df.itertuples():
|
|
561
562
|
data.append(row.weighting * 100)
|
|
562
563
|
categories.append(f"{row.aggregated_title} ({row.weighting*100:.1f}%)")
|
|
563
564
|
|
|
@@ -834,7 +835,7 @@ def generate_report(context):
|
|
|
834
835
|
|
|
835
836
|
last_row_height = right_height - liquid_height - 0.85 * cm
|
|
836
837
|
|
|
837
|
-
last_height = min(
|
|
838
|
+
last_height = min( # noqa: F841
|
|
838
839
|
max(industry_height - liquid_height + 6, 3.564 * cm), max_available_height - liquid_height
|
|
839
840
|
) # 6 because of the drawn string
|
|
840
841
|
|
|
@@ -21,7 +21,6 @@ from reportlab.platypus import (
|
|
|
21
21
|
BaseDocTemplate,
|
|
22
22
|
Image,
|
|
23
23
|
PageTemplate,
|
|
24
|
-
Paragraph,
|
|
25
24
|
Spacer,
|
|
26
25
|
Table,
|
|
27
26
|
TableStyle,
|
|
@@ -29,6 +28,8 @@ from reportlab.platypus import (
|
|
|
29
28
|
from reportlab.platypus.flowables import KeepTogether, TopPadder
|
|
30
29
|
from reportlab.platypus.frames import Frame
|
|
31
30
|
from svglib.svglib import svg2rlg
|
|
31
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
32
|
+
|
|
32
33
|
from wbreport.models import ReportAsset
|
|
33
34
|
from wbreport.pdf.charts.pie import (
|
|
34
35
|
get_pie_chart_horizontal,
|
|
@@ -44,12 +45,12 @@ from wbreport.pdf.tables.aggregated_tables import (
|
|
|
44
45
|
from wbreport.pdf.tables.data_tables import get_simple_data_table
|
|
45
46
|
|
|
46
47
|
|
|
47
|
-
def generate_report(context):
|
|
48
|
+
def generate_report(context): # noqa: C901
|
|
48
49
|
debug = False
|
|
49
50
|
|
|
50
51
|
main_features_dict_tmp = context["information_table"]
|
|
51
52
|
main_features_dict = {}
|
|
52
|
-
for
|
|
53
|
+
for v in main_features_dict_tmp.values():
|
|
53
54
|
main_features_dict.update(v)
|
|
54
55
|
# Monthly returns table as dataframe, None is no value
|
|
55
56
|
monthly_returns = context["monthly_returns"]
|
|
@@ -129,7 +130,7 @@ def generate_report(context):
|
|
|
129
130
|
s_base_small_justified = ParagraphStyle(
|
|
130
131
|
name="s_base_small_justified", parent=s_base, fontSize=6.5, leading=7, alignment=TA_JUSTIFY
|
|
131
132
|
)
|
|
132
|
-
s_base_small_justified_indent = ParagraphStyle(
|
|
133
|
+
s_base_small_justified_indent = ParagraphStyle( # noqa: F841
|
|
133
134
|
name="s_base_small_justified_indent", parent=s_base_small_justified, leftIndent=CONTENT_OFFSET
|
|
134
135
|
)
|
|
135
136
|
s_base_indent = ParagraphStyle(name="s_description", parent=s_base, spaceBefore=8, leftIndent=CONTENT_OFFSET)
|
|
@@ -143,7 +144,7 @@ def generate_report(context):
|
|
|
143
144
|
s_table_medium_leading = ParagraphStyle(name="s_table_medium_leading", parent=s_table_medium, leading=13.9)
|
|
144
145
|
s_table_large = ParagraphStyle(name="s_table_large", parent=s_table_medium, fontSize=11, leading=11)
|
|
145
146
|
s_table_large_center = ParagraphStyle(name="s_table_large", parent=s_table_large, alignment=TA_CENTER)
|
|
146
|
-
s_table_large_center_padding = ParagraphStyle(
|
|
147
|
+
s_table_large_center_padding = ParagraphStyle( # noqa: F841
|
|
147
148
|
name="s_table_large", parent=s_table_large_center, spaceBefore=20, spaceAfter=20
|
|
148
149
|
)
|
|
149
150
|
s_table_center = ParagraphStyle(
|
|
@@ -284,7 +285,7 @@ def generate_report(context):
|
|
|
284
285
|
)
|
|
285
286
|
return title_table
|
|
286
287
|
|
|
287
|
-
def impress(
|
|
288
|
+
def impress(elements):
|
|
288
289
|
style = s_table_headline_2
|
|
289
290
|
table_data = [
|
|
290
291
|
[
|
|
@@ -312,7 +313,7 @@ def generate_report(context):
|
|
|
312
313
|
]
|
|
313
314
|
)
|
|
314
315
|
)
|
|
315
|
-
|
|
316
|
+
elements.append(KeepTogether(TopPadder(t)))
|
|
316
317
|
|
|
317
318
|
# Description
|
|
318
319
|
elements.append(generate_title(general_data["title"]))
|
|
@@ -347,7 +348,7 @@ def generate_report(context):
|
|
|
347
348
|
# Price Timeseries Chart
|
|
348
349
|
elements.append(
|
|
349
350
|
get_timeseries_chart(
|
|
350
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
351
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
351
352
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
352
353
|
height=4.34 * cm,
|
|
353
354
|
color=c_product,
|
|
@@ -567,7 +568,7 @@ def generate_report(context):
|
|
|
567
568
|
|
|
568
569
|
data = list()
|
|
569
570
|
categories = list()
|
|
570
|
-
for
|
|
571
|
+
for row in df.itertuples():
|
|
571
572
|
data.append(row.weighting * 100)
|
|
572
573
|
categories.append(f"{row.aggregated_title} ({row.weighting*100:.1f}%)")
|
|
573
574
|
|
|
@@ -22,7 +22,6 @@ from reportlab.platypus import (
|
|
|
22
22
|
Image,
|
|
23
23
|
NextPageTemplate,
|
|
24
24
|
PageTemplate,
|
|
25
|
-
Paragraph,
|
|
26
25
|
Spacer,
|
|
27
26
|
Table,
|
|
28
27
|
TableStyle,
|
|
@@ -30,6 +29,8 @@ from reportlab.platypus import (
|
|
|
30
29
|
from reportlab.platypus.flowables import KeepTogether, TopPadder
|
|
31
30
|
from reportlab.platypus.frames import Frame
|
|
32
31
|
from svglib.svglib import svg2rlg
|
|
32
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
33
|
+
|
|
33
34
|
from wbreport.models import ReportAsset
|
|
34
35
|
from wbreport.pdf.charts.pie import (
|
|
35
36
|
get_pie_chart_horizontal,
|
|
@@ -42,7 +43,7 @@ from wbreport.pdf.tables.aggregated_tables import get_simple_aggregated_table
|
|
|
42
43
|
from wbreport.pdf.tables.data_tables import get_simple_data_table
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
def generate_report(context):
|
|
46
|
+
def generate_report(context): # noqa: C901
|
|
46
47
|
debug = False
|
|
47
48
|
### Product Data ###
|
|
48
49
|
# Main Feature table as dictionary
|
|
@@ -120,7 +121,7 @@ def generate_report(context):
|
|
|
120
121
|
s_base_small_justified = ParagraphStyle(
|
|
121
122
|
name="s_base_small_justified", parent=s_base, fontSize=6.5, leading=7, alignment=TA_JUSTIFY
|
|
122
123
|
)
|
|
123
|
-
s_base_small_justified_indent = ParagraphStyle(
|
|
124
|
+
s_base_small_justified_indent = ParagraphStyle( # noqa: F841
|
|
124
125
|
name="s_base_small_justified_indent", parent=s_base_small_justified, leftIndent=CONTENT_OFFSET
|
|
125
126
|
)
|
|
126
127
|
s_base_indent = ParagraphStyle(name="s_description", parent=s_base, spaceBefore=8, leftIndent=CONTENT_OFFSET)
|
|
@@ -134,7 +135,7 @@ def generate_report(context):
|
|
|
134
135
|
s_table_medium_leading = ParagraphStyle(name="s_table_medium_leading", parent=s_table_medium, leading=13.9)
|
|
135
136
|
s_table_large = ParagraphStyle(name="s_table_large", parent=s_table_medium, fontSize=11, leading=11)
|
|
136
137
|
s_table_large_center = ParagraphStyle(name="s_table_large", parent=s_table_large, alignment=TA_CENTER)
|
|
137
|
-
s_table_large_center_padding = ParagraphStyle(
|
|
138
|
+
s_table_large_center_padding = ParagraphStyle( # noqa: F841
|
|
138
139
|
name="s_table_large", parent=s_table_large_center, spaceBefore=20, spaceAfter=20
|
|
139
140
|
)
|
|
140
141
|
s_table_center = ParagraphStyle(
|
|
@@ -277,7 +278,7 @@ def generate_report(context):
|
|
|
277
278
|
)
|
|
278
279
|
return title_table
|
|
279
280
|
|
|
280
|
-
def impress(
|
|
281
|
+
def impress(elements):
|
|
281
282
|
style = s_table_headline_2
|
|
282
283
|
table_data = [
|
|
283
284
|
[
|
|
@@ -305,7 +306,7 @@ def generate_report(context):
|
|
|
305
306
|
]
|
|
306
307
|
)
|
|
307
308
|
)
|
|
308
|
-
|
|
309
|
+
elements.append(KeepTogether(TopPadder(t)))
|
|
309
310
|
|
|
310
311
|
############################
|
|
311
312
|
## Page 1: BEGINING
|
|
@@ -337,7 +338,7 @@ def generate_report(context):
|
|
|
337
338
|
# Price Timeseries Chart
|
|
338
339
|
elements.append(
|
|
339
340
|
get_timeseries_chart(
|
|
340
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
341
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
341
342
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
342
343
|
height=4.34 * cm,
|
|
343
344
|
color=c_product,
|
|
@@ -358,7 +359,7 @@ def generate_report(context):
|
|
|
358
359
|
"<strong>Top 3 Contributors</strong>",
|
|
359
360
|
"<strong>Bottom 3 Contributors</strong>",
|
|
360
361
|
],
|
|
361
|
-
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors)),
|
|
362
|
+
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors, strict=False)),
|
|
362
363
|
width=CONTENT_WIDTH_PAGE1_LEFT,
|
|
363
364
|
header_row_height=0.85 * cm,
|
|
364
365
|
data_row_height=0.39 * cm,
|
|
@@ -559,7 +560,7 @@ def generate_report(context):
|
|
|
559
560
|
|
|
560
561
|
data = list()
|
|
561
562
|
categories = list()
|
|
562
|
-
for
|
|
563
|
+
for row in df.itertuples():
|
|
563
564
|
data.append(row.weighting * 100)
|
|
564
565
|
categories.append(f"{row.aggregated_title} ({row.weighting*100:.1f}%)")
|
|
565
566
|
|
|
@@ -21,7 +21,6 @@ from reportlab.platypus import (
|
|
|
21
21
|
Image,
|
|
22
22
|
NextPageTemplate,
|
|
23
23
|
PageTemplate,
|
|
24
|
-
Paragraph,
|
|
25
24
|
Spacer,
|
|
26
25
|
Table,
|
|
27
26
|
TableStyle,
|
|
@@ -29,6 +28,8 @@ from reportlab.platypus import (
|
|
|
29
28
|
from reportlab.platypus.flowables import KeepTogether, TopPadder
|
|
30
29
|
from reportlab.platypus.frames import Frame
|
|
31
30
|
from svglib.svglib import svg2rlg
|
|
31
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
32
|
+
|
|
32
33
|
from wbreport.models import ReportAsset
|
|
33
34
|
from wbreport.pdf.charts.pie import (
|
|
34
35
|
get_pie_chart_horizontal,
|
|
@@ -42,7 +43,7 @@ from wbreport.pdf.tables.aggregated_tables import get_simple_aggregated_table
|
|
|
42
43
|
from wbreport.pdf.tables.data_tables import get_simple_data_table
|
|
43
44
|
|
|
44
45
|
|
|
45
|
-
def generate_report(context):
|
|
46
|
+
def generate_report(context): # noqa: C901
|
|
46
47
|
debug = False
|
|
47
48
|
|
|
48
49
|
main_features_dict = context["information_table"]["Main Features"]
|
|
@@ -133,7 +134,7 @@ def generate_report(context):
|
|
|
133
134
|
s_table_medium = ParagraphStyle(name="s_table_medium", parent=s_table_base, fontSize=9, leading=8)
|
|
134
135
|
s_table_medium_leading = ParagraphStyle(name="s_table_medium_leading", parent=s_table_medium, leading=13.9)
|
|
135
136
|
s_table_large = ParagraphStyle(name="s_table_large", parent=s_table_medium, fontSize=11, leading=11)
|
|
136
|
-
s_table_large_center = ParagraphStyle(name="s_table_large", parent=s_table_large, alignment=TA_CENTER)
|
|
137
|
+
s_table_large_center = ParagraphStyle(name="s_table_large", parent=s_table_large, alignment=TA_CENTER) # noqa: F841
|
|
137
138
|
s_table_center = ParagraphStyle(
|
|
138
139
|
name="s_table_center",
|
|
139
140
|
parent=s_table_base,
|
|
@@ -330,7 +331,7 @@ def generate_report(context):
|
|
|
330
331
|
# Price Timeseries Chart
|
|
331
332
|
elements.append(
|
|
332
333
|
get_timeseries_chart(
|
|
333
|
-
data=[list(zip(prices.index, prices.net_value))],
|
|
334
|
+
data=[list(zip(prices.index, prices.net_value, strict=False))],
|
|
334
335
|
width=CONTENT_WIDTH_PAGE1_LEFT - CONTENT_OFFSET,
|
|
335
336
|
height=4.34 * cm,
|
|
336
337
|
color=c_product,
|
|
@@ -351,7 +352,7 @@ def generate_report(context):
|
|
|
351
352
|
"<strong>Top 3 Contributors</strong>",
|
|
352
353
|
"<strong>Bottom 3 Contributors</strong>",
|
|
353
354
|
],
|
|
354
|
-
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors)),
|
|
355
|
+
data=list(zip(top_3_holdings, top_3_contributors, bottom_3_contributors, strict=False)),
|
|
355
356
|
width=CONTENT_WIDTH_PAGE1_LEFT,
|
|
356
357
|
header_row_height=0.85 * cm,
|
|
357
358
|
data_row_height=0.39 * cm,
|
|
@@ -553,7 +554,7 @@ def generate_report(context):
|
|
|
553
554
|
|
|
554
555
|
data = list()
|
|
555
556
|
categories = list()
|
|
556
|
-
for
|
|
557
|
+
for row in df.itertuples():
|
|
557
558
|
data.append(row.weighting * 100)
|
|
558
559
|
categories.append(f"{row.aggregated_title} ({row.weighting*100:.1f}%)")
|
|
559
560
|
|
|
@@ -2,7 +2,8 @@ import numpy as np
|
|
|
2
2
|
from reportlab.lib.colors import grey
|
|
3
3
|
from reportlab.lib.enums import TA_CENTER
|
|
4
4
|
from reportlab.lib.styles import ParagraphStyle
|
|
5
|
-
from reportlab.platypus import
|
|
5
|
+
from reportlab.platypus import Spacer, Table, TableStyle
|
|
6
|
+
from wbcore.utils.reportlab import FormattedParagraph as Paragraph
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def get_simple_aggregated_table(
|
|
@@ -37,7 +38,7 @@ def get_simple_aggregated_table(
|
|
|
37
38
|
|
|
38
39
|
table_row.append(Paragraph(str(year), style=row_style))
|
|
39
40
|
|
|
40
|
-
for
|
|
41
|
+
for _, element in row.items():
|
|
41
42
|
if element.get("performance", None) is None:
|
|
42
43
|
table_row.append(Spacer(width=0, height=0))
|
|
43
44
|
else:
|
|
@@ -110,7 +111,7 @@ def get_fund_table(
|
|
|
110
111
|
table_data.append(table_row)
|
|
111
112
|
|
|
112
113
|
# Generate table
|
|
113
|
-
for
|
|
114
|
+
for _, row in df.iterrows():
|
|
114
115
|
table_row = list()
|
|
115
116
|
|
|
116
117
|
for value in row:
|
|
@@ -6,12 +6,9 @@ class ReportVersionEndpointConfig(EndpointViewConfig):
|
|
|
6
6
|
def get_endpoint(self, **kwargs):
|
|
7
7
|
return None
|
|
8
8
|
|
|
9
|
-
def
|
|
9
|
+
def get_instance_endpoint(self, **kwargs):
|
|
10
10
|
return reverse("wbreport:reportversion-list", request=self.request)
|
|
11
11
|
|
|
12
|
-
def get_instance_endpoint(self):
|
|
13
|
-
return self.get_list_endpoint()
|
|
14
|
-
|
|
15
12
|
|
|
16
13
|
class ReportEndpointConfig(EndpointViewConfig):
|
|
17
14
|
def get_endpoint(self, **kwargs):
|
|
@@ -19,12 +16,8 @@ class ReportEndpointConfig(EndpointViewConfig):
|
|
|
19
16
|
|
|
20
17
|
|
|
21
18
|
class ReportVersionReportEndpointConfig(EndpointViewConfig):
|
|
22
|
-
|
|
23
|
-
return reverse("wbreport:report-version-list", args=[self.view.kwargs["report_id"]], request=self.request)
|
|
19
|
+
pass
|
|
24
20
|
|
|
25
21
|
|
|
26
22
|
class ReportVersionReportHTMEndpointConfig(EndpointViewConfig):
|
|
27
|
-
|
|
28
|
-
return reverse(
|
|
29
|
-
"wbreport:reportversion-rawhtml-list", args=[self.view.kwargs["report_version_id"]], request=self.request
|
|
30
|
-
)
|
|
23
|
+
pass
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0008_alter_report_file_content_type.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{wbreport-1.50.14 → wbreport-1.58.3}/wbreport/migrations/0013_alter_reportversion_context.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|