ferrosoft.apps.befundung package

Subpackages

Submodules

ferrosoft.apps.befundung.admin module

ferrosoft.apps.befundung.apps module

class ferrosoft.apps.befundung.apps.BefundungConfig(app_name, app_module)[source]

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'ferrosoft.apps.befundung'
verbose_name = 'Examination report'

ferrosoft.apps.befundung.email module

ferrosoft.apps.befundung.email.attach_photos(message, report, conf)[source]
ferrosoft.apps.befundung.email.send_error_mail(report, conf)[source]
ferrosoft.apps.befundung.email.send_examination_mail(report, conf, pdf_blob)[source]

ferrosoft.apps.befundung.forms module

class ferrosoft.apps.befundung.forms.ExaminationDependentForm(*args, **kwargs)[source]

Bases: ModelForm

base_fields = {}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

class ferrosoft.apps.befundung.forms.ExaminationForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

class Meta[source]

Bases: object

fields = '__all__'
model

alias of Examination

base_fields = {'auditor_token': <django.forms.fields.CharField object>, 'comment': <django.forms.fields.CharField object>, 'customer_name': <django.forms.fields.CharField object>, 'exam_date': <django.forms.fields.CharField object>, 'license_plate_no': <django.forms.fields.CharField object>, 'material': <django.forms.fields.CharField object>, 'refused_material': <django.forms.fields.CharField object>, 'trader_approval': <django.forms.fields.CharField object>, 'weighing_slip_id': <django.forms.fields.CharField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class ferrosoft.apps.befundung.forms.PhotoForm(*args, **kwargs)[source]

Bases: ModelForm

class Meta[source]

Bases: object

fields = ['image_file']
model

alias of Photo

base_fields = {'image_file': <django.forms.fields.FileField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

class ferrosoft.apps.befundung.forms.ReductionForm(*args, **kwargs)[source]

Bases: ModelForm

class Meta[source]

Bases: object

fields = ['reduction_type', 'value']
model

alias of Reduction

base_fields = {'reduction_type': <django.forms.fields.TypedChoiceField object>, 'value': <django.forms.fields.DecimalField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

save(commit=True)[source]

Save this form’s self.instance object if commit=True. Otherwise, add a save_m2m() method to the form which can be called after the instance is saved manually at a later time. Return the model instance.

class ferrosoft.apps.befundung.forms.RefusalForm(*args, **kwargs)[source]

Bases: ExaminationDependentForm

class Meta[source]

Bases: object

fields = ['material_name', 'value']
model

alias of Refusal

base_fields = {'material_name': <django.forms.fields.CharField object>, 'value': <django.forms.fields.DecimalField object>}
declared_fields = {}
property media

Return all media required to render the widgets on this form.

class ferrosoft.apps.befundung.forms.SettingsForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]

Bases: ModelForm

class Meta[source]

Bases: object

fields = '__all__'
model

alias of Settings

base_fields = {'email_body_template': <django.forms.fields.CharField object>, 'email_pdf_attachment_name_template': <django.forms.fields.CharField object>, 'email_photo_attachment_name_template': <django.forms.fields.CharField object>, 'email_recipient_address': <django.forms.fields.CharField object>, 'email_sender_address': <django.forms.fields.CharField object>, 'email_subject_template': <django.forms.fields.CharField object>, 'sftp_client_key': <django.forms.fields.CharField object>, 'sftp_client_key_password': <django.forms.fields.CharField object>, 'sftp_enable_document_upload': <django.forms.fields.BooleanField object>, 'sftp_enable_image_upload': <django.forms.fields.BooleanField object>, 'sftp_host_key': <django.forms.fields.CharField object>, 'sftp_hostname': <django.forms.fields.CharField object>, 'sftp_port': <django.forms.fields.IntegerField object>, 'sftp_remote_dir': <django.forms.fields.CharField object>, 'sftp_username': <django.forms.fields.CharField object>, 'template_content': <django.forms.fields.FileField object>, 'template_logo_height': <django.forms.fields.CharField object>, 'template_logo_url': <django.forms.fields.CharField object>, 'template_reduction_label_dirt': <django.forms.fields.CharField object>, 'template_reduction_label_garbage': <django.forms.fields.CharField object>, 'template_reduction_label_junk': <django.forms.fields.CharField object>, 'template_reduction_label_rubber': <django.forms.fields.CharField object>, 'template_reduction_label_water': <django.forms.fields.CharField object>, 'template_show_images': <django.forms.fields.BooleanField object>, 'template_show_reductions': <django.forms.fields.BooleanField object>}
clean()[source]

Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.

declared_fields = {}
property media

Return all media required to render the widgets on this form.

ferrosoft.apps.befundung.models module

class ferrosoft.apps.befundung.models.Examination(id, weighing_slip_id, trader_approval, comment, exam_date, material, license_plate_no, auditor_token, customer_name, refused_material)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

auditor_token

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

comment

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

customer_name

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

exam_date

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

id

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

license_plate_no

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

material

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.befundung.models.ExaminationManager object>
photos

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

reductions

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

refusals

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

refused_material

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

trader_approval

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

weighing_slip_id

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.befundung.models.ExaminationManager(*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.befundung.models.ExaminationPhotoRequest(*args, **kwargs)[source]

Bases: UUIDModel

Unvalidated examination photo request for debugging purposes.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

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

objects = <django.db.models.manager.Manager object>
payload

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

request

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.

request_id
class ferrosoft.apps.befundung.models.ExaminationRequest(*args, **kwargs)[source]

Bases: UUIDModel

Unvalidated examination request for debugging purposes.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

creation_date

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

get_absolute_url()[source]
get_next_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=True, **kwargs)
get_previous_by_creation_date(*, field=<django.db.models.fields.DateTimeField: creation_date>, is_next=False, **kwargs)
id

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

objects = <django.db.models.manager.Manager object>
payload

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

photos

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

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

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

weighing_slip_id

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.befundung.models.Log(id, date, message)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

date

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

get_next_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=True, **kwargs)
get_previous_by_date(*, field=<django.db.models.fields.DateTimeField: date>, is_next=False, **kwargs)
id

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

message

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

objects = <django.db.models.manager.Manager object>
class ferrosoft.apps.befundung.models.Photo(id, examination, image_file)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

examination

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.

examination_id
id

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

image_file

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
objects = <django.db.models.manager.Manager object>
class ferrosoft.apps.befundung.models.Reduction(id, examination, reduction_type, label, value)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

class Type(*values)[source]

Bases: TextChoices

CUSTOM = 'custom'
DIRT = 'dirt'
GARBAGE = 'garbage'
JUNK = 'junk'
RUBBER = 'rubber'
WATER = 'water'
examination

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.

examination_id
get_reduction_type_display(*, field=<django.db.models.fields.CharField: reduction_type>)
id

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

label

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

objects = <django.db.models.manager.Manager object>
reduction_type

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

value

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.befundung.models.Refusal(id, examination, material_name, value)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

examination

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.

examination_id
id

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

material_name

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

objects = <django.db.models.manager.Manager object>
value

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.befundung.models.Report(examination, images)[source]

Bases: object

examination: dict

Serialized representation of Examination model.

This is not the Examination model for historic reasons.

images: Iterable[TransformedPhoto]
class ferrosoft.apps.befundung.models.Settings(id, email_subject_template, email_body_template, email_sender_address, email_recipient_address, email_pdf_attachment_name_template, email_photo_attachment_name_template, template_content, template_logo_url, template_logo_height, template_show_images, template_show_reductions, template_reduction_label_water, template_reduction_label_dirt, template_reduction_label_junk, template_reduction_label_garbage, template_reduction_label_rubber, sftp_enable_image_upload, sftp_enable_document_upload, sftp_hostname, sftp_username, sftp_port, sftp_remote_dir, sftp_client_key_password, sftp_client_key, sftp_host_key)[source]

Bases: UUIDModel

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

email_body_template

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

email_pdf_attachment_name_template

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

email_photo_attachment_name_template

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

email_recipient_address

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

email_sender_address

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

email_subject_template

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

format_image_name(report, count, media_type)[source]
Return type:

str

format_report_pdf_name(report)[source]
Return type:

str

classmethod get_instance()[source]
Return type:

Settings

get_template()[source]
Return type:

Template

id

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

objects = <django.db.models.manager.Manager object>
sftp_client_key

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

sftp_client_key_password

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

sftp_enable_document_upload

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

sftp_enable_image_upload

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

sftp_host_key

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

sftp_hostname

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

sftp_port

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

sftp_remote_dir

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

sftp_username

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

template_content

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
template_logo_height

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

template_logo_url

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

template_reduction_label_dirt

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

template_reduction_label_garbage

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

template_reduction_label_junk

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

template_reduction_label_rubber

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

template_reduction_label_water

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

template_show_images

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

template_show_reductions

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.befundung.models.TransformedPhoto(media_type, binary_data, encoded_data)[source]

Bases: object

binary_data: bytes
encoded_data: str
media_type: str
ferrosoft.apps.befundung.models.create_log(message)[source]

ferrosoft.apps.befundung.request module

async ferrosoft.apps.befundung.request.report_examination(examination_id: str)[source]
async ferrosoft.apps.befundung.request.report_examination_errors(request_id, errors, replay_uri)[source]

ferrosoft.apps.befundung.sftp module

ferrosoft.apps.befundung.sftp.load_key(conf)[source]
Return type:

Tuple[RSAKey, HostKeys]

ferrosoft.apps.befundung.sftp.put_examination_report(report, conf, pdf_blob)[source]
ferrosoft.apps.befundung.sftp.sftp_connection(conf, *, timeout=30.0)[source]
Return type:

Iterator[SFTPClient]

ferrosoft.apps.befundung.tables module

class ferrosoft.apps.befundung.tables.LogTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]

Bases: Table

class Meta[source]

Bases: object

fields = ('date', 'message')
model

alias of Log

template_name = 'ferrobase/table_bootstrap5.html'
base_columns = {'date': <ferrosoft.apps.ferrobase.tables.columns.DateTimeColumn object>, 'message': <django_tables2.columns.base.Column object>}

ferrosoft.apps.befundung.tests module

ferrosoft.apps.befundung.urls module

ferrosoft.apps.befundung.views module

class ferrosoft.apps.befundung.views.LogListView(**kwargs)[source]

Bases: SingleTableView

extra_context = {'title': 'Protocol of examination report generator'}
model

alias of Log

ordering = '-date'
table_class

alias of LogTable

template_name = 'befundung/log.html'
class ferrosoft.apps.befundung.views.ReplayListView(**kwargs)[source]

Bases: PlatformActivityMixin, LoginRequiredMixin, ListView

activity_app = 'befundung'

Django identifier of the app the activity belongs to. If it is None, the app is derived from template_name.

activity_title = 'Replay Examination'

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.

get_queryset()[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

model

alias of ExaminationRequest

paginate_by = 10
template_name = 'ferrobase/bootstrap5/list_view.html'
ferrosoft.apps.befundung.views.demo(request)[source]
ferrosoft.apps.befundung.views.replay_request(request, pk)[source]
ferrosoft.apps.befundung.views.settings_index(request)[source]