ferrosoft.apps.reporting package

Subpackages

Submodules

ferrosoft.apps.reporting.admin module

ferrosoft.apps.reporting.apps module

class ferrosoft.apps.reporting.apps.ReportingConfig(app_name, app_module)[source]

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'ferrosoft.apps.reporting'

ferrosoft.apps.reporting.models module

class ferrosoft.apps.reporting.models.Report(id, creation_time, status, document, func_name, func_args, func_kwargs, return_url)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

creation_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

document

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

document_id
func_args

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

func_kwargs

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

func_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

generate_document()[source]
Return type:

bytes

get_absolute_url()[source]
get_next_by_creation_time(*, field=<django.db.models.fields.DateTimeField: creation_time>, is_next=True, **kwargs)
get_previous_by_creation_time(*, field=<django.db.models.fields.DateTimeField: creation_time>, is_next=False, **kwargs)
get_status_display(*, field=<django.db.models.fields.IntegerField: status>)
id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <ferrosoft.apps.reporting.models.ReportManager object>
return_url

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

status

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class ferrosoft.apps.reporting.models.ReportManager(*args, **kwargs)[source]

Bases: Manager

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class ferrosoft.apps.reporting.models.ReportStatus(*values)[source]

Bases: IntegerChoices

CREATED = 2
FAILED = 3
NEW = 1

ferrosoft.apps.reporting.services module

class ferrosoft.apps.reporting.services.Params(owner=None, directory=None, expiry_days=7, file_name=None, return_url=None, media_type='application/pdf')[source]

Bases: object

directory: Directory | None = None
expiry_days: int = 7
file_name: str | None = None
media_type: str = 'application/pdf'
owner: LocalUser = None
return_url: str | None = None
ferrosoft.apps.reporting.services.prepare_report(*args, params=None, **kwargs)[source]

Prepare an empty report whose contents can be generated by redirecting to Report.get_absolute_url.

Parameters:
  • params (Params) – Parameters for StoredFile and Report.

  • *args – Function object and arguments. This function is called and should return a PDF blob.

  • **kwargs – Function keyword arguments.

Return type:

Report

Returns: Report model instance.

ferrosoft.apps.reporting.tasks module

async ferrosoft.apps.reporting.tasks.generate_document(report_id: str)[source]

ferrosoft.apps.reporting.tests module

ferrosoft.apps.reporting.urls module

ferrosoft.apps.reporting.views module

class ferrosoft.apps.reporting.views.ReportGeneratorView(**kwargs)[source]

Bases: LoginRequiredMixin, PlatformActivityMixin, DetailView

activity_title = 'Report'

Activity title should be a very short label e.g. indicating the current model being operated on.

get_context_data(**kwargs)[source]

Inject activity metadata (title, app, container, help URL) into the context.

Raises:

RuntimeError – If neither activity_app nor a string template_name is defined and the app label cannot be inferred.

model

alias of Report

template_name = 'reporting/generator/index.html'
ferrosoft.apps.reporting.views.report_generator_modal_content(request, report)[source]

Render HTML content for a report generator modal.

It is expected that the report.content has the HTML content of the report written to it. The content will be replaced with PDF content.