Skip to content
Snippets Groups Projects
Commit 43bfd42d authored by ml bonhomme's avatar ml bonhomme :bee: Committed by Erwan Rouchet
Browse files

Add text orientation to transcriptions, editable in admin

parent 8277c09c
No related branches found
No related tags found
1 merge request!1518Add text orientation to transcriptions, editable in admin
......@@ -110,8 +110,8 @@ class ElementAdmin(admin.ModelAdmin):
class TranscriptionAdmin(admin.ModelAdmin):
list_display = ('id', 'text', 'confidence', 'element', )
fields = ('id', 'text', 'confidence', 'element', )
list_display = ('id', 'text', 'confidence', 'orientation', 'element', )
fields = ('id', 'text', 'confidence', 'orientation', 'element', )
readonly_fields = ('id', )
raw_id_fields = ('element', )
......
# Generated by Django 3.2.6 on 2021-10-22 08:27
import enumfields.fields
from django.db import migrations
import arkindex.documents.models
class Migration(migrations.Migration):
dependencies = [
('documents', '0045_alter_element_rotation_angle'),
]
operations = [
migrations.AddField(
model_name='transcription',
name='orientation',
field=enumfields.fields.EnumField(default='horizontal-lr', enum=arkindex.documents.models.TextOrientation, max_length=50),
),
]
......@@ -486,6 +486,13 @@ class EntityLink(models.Model):
super().save(*args, **kwargs)
class TextOrientation(Enum):
HorizontalLeftToRight = 'horizontal-lr'
HorizontalRightToLeft = 'horizontal-rl'
VerticalRightToLeft = 'vertical-rl'
VerticalLeftToRight = 'vertical-lr'
class Transcription(models.Model):
"""
A transcription on:
......@@ -505,6 +512,7 @@ class Transcription(models.Model):
blank=True,
)
text = models.TextField()
orientation = EnumField(TextOrientation, default=TextOrientation.HorizontalLeftToRight, max_length=50)
confidence = models.FloatField(null=True, blank=True)
entities = models.ManyToManyField(
Entity,
......
......@@ -70,6 +70,7 @@ SELECT "documents_transcription"."id",
"documents_transcription"."element_id",
"documents_transcription"."worker_version_id",
"documents_transcription"."text",
"documents_transcription"."orientation",
"documents_transcription"."confidence"
FROM "documents_transcription"
WHERE "documents_transcription"."element_id" IN ('{page_id}'::uuid);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment