Corrected example in report mixin (#5801)

* Corrected report mixin example

* Remove unused file
This commit is contained in:
Michael 2023-10-27 14:08:30 +02:00 committed by GitHub
parent c47fa01965
commit 70578500ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,8 @@ class SampleReportPlugin(ReportMixin, InvenTreePlugin):
"""Some custom function which is not required for the plugin to function""" """Some custom function which is not required for the plugin to function"""
return random.randint(0, 100) return random.randint(0, 100)
def add_report_context(self, instance, request, context): def add_report_context(self, report_instance, model_instance, request, context):
"""Add example content to the report instance""" """Add example content to the report instance"""
# We can add any extra context data we want to the report # We can add any extra context data we want to the report
@ -53,7 +54,7 @@ class SampleReportPlugin(ReportMixin, InvenTreePlugin):
context['random_int'] = self.some_custom_function() context['random_int'] = self.some_custom_function()
# We can also add extra data to the context which is specific to the report type # We can also add extra data to the context which is specific to the report type
context['is_purchase_order'] = isinstance(instance, PurchaseOrderReport) context['is_purchase_order'] = isinstance(report_instance, PurchaseOrderReport)
# We can also use the 'request' object to add extra context data # We can also use the 'request' object to add extra context data
context['request_method'] = request.method context['request_method'] = request.method