Translation App models documentation
- class translation_app.models.Cell(*args, **kwargs)[source]
Bases:
EmbeddedModel
Represents a single cell in a column.
- Parameters:
id – Primary key.
text – Current cell content.
original_text – Original unmodified content.
row_number – Position of the row in the table.
is_translated – Whether the cell has been translated.
detected_language – Language detected from original text.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- detected_language
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.
- is_translated
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- original_text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- row_number
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- text
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class translation_app.models.Column(*args, **kwargs)[source]
Bases:
EmbeddedModel
Represents a column in a table containing a list of Cell objects.
- Parameters:
id – Primary key.
name – Name of the column.
rows_number – Total number of rows in the column.
column_number – Index of the column.
cells – List of embedded Cell objects.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- cells
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- column_number
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.
- name
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- rows_number
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- class translation_app.models.File(*args, **kwargs)[source]
Bases:
Model
Represents an uploaded file with structured tabular content.
- Parameters:
id – Primary key.
title – File name or title.
upload_time – When the file was uploaded.
columns – Embedded list of Column objects.
columns_number – Number of columns in the file.
- exception DoesNotExist
Bases:
ObjectDoesNotExist
- exception MultipleObjectsReturned
Bases:
MultipleObjectsReturned
- columns
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- columns_number
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod delete_file(file_id)[source]
Atomic transaction deleting safely a file by ID.
- Parameters:
file_id – The ID of the file to delete.
- get_next_by_upload_time(*, field=<django.db.models.fields.DateTimeField: upload_time>, is_next=True, **kwargs)
- get_previous_by_upload_time(*, field=<django.db.models.fields.DateTimeField: upload_time>, 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>
- classmethod revert_cell(file_id, col_num, row_num)[source]
Atomic transaction Reverting a specific cell to its original state.
- Parameters:
file_id – File ID.
col_num – Column index.
row_num – Row index.
- title
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
- classmethod update_cells(file_id, idx_list, text_list)[source]
Atomic transaction updating multiple cells within the file.
- Parameters:
file_id – ID of the file to update.
idx_list – (List[Tuple[int, int]])List with indexes of translated texts
text_list
List[Tuple[str
str
status. (bool] Translated text and detected language and)
- upload_time
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.