Improve model help texts. Add respective migrations.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2018-09-17 02:46:16 -04:00
parent 03c54395cc
commit a372fc5a07
10 changed files with 245 additions and 28 deletions

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('document_parsing', '0003_documenttypesettings'),
]
operations = [
migrations.AlterField(
model_name='documentpagecontent',
name='content',
field=models.TextField(blank=True, help_text='The actual text content as extracted by the document parsing backend.', verbose_name='Content'),
),
]

View File

@@ -15,7 +15,12 @@ class DocumentPageContent(models.Model):
on_delete=models.CASCADE, related_name='content', to=DocumentPage,
verbose_name=_('Document page')
)
content = models.TextField(blank=True, verbose_name=_('Content'))
content = models.TextField(
blank=True, help_text=_(
'The actual text content as extracted by the document '
'parsing backend.'
), verbose_name=_('Content')
)
objects = DocumentPageContentManager()
@@ -33,8 +38,9 @@ class DocumentTypeSettings(models.Model):
to=DocumentType, unique=True, verbose_name=_('Document type')
)
auto_parsing = models.BooleanField(
default=True,
verbose_name=_('Automatically queue newly created documents for parsing.')
default=True, verbose_name=_(
'Automatically queue newly created documents for parsing.'
)
)
objects = DocumentTypeSettingsManager()

View File

@@ -0,0 +1,81 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:45
from __future__ import unicode_literals
from django.db import migrations, models
import uuid
class Migration(migrations.Migration):
dependencies = [
('documents', '0044_auto_20180823_0452'),
]
operations = [
migrations.AlterField(
model_name='document',
name='date_added',
field=models.DateTimeField(auto_now_add=True, db_index=True, help_text='The server date and time when the document was finally processed and added to the system.', verbose_name='Added'),
),
migrations.AlterField(
model_name='document',
name='deleted_date_time',
field=models.DateTimeField(blank=True, help_text='The server date and time when the document was moved to the trash.', null=True, verbose_name='Date and time trashed'),
),
migrations.AlterField(
model_name='document',
name='description',
field=models.TextField(blank=True, default='', help_text='An optional short text describing a document.', verbose_name='Description'),
),
migrations.AlterField(
model_name='document',
name='in_trash',
field=models.BooleanField(db_index=True, default=False, editable=False, help_text='Whether or not this document is in the trash.', verbose_name='In trash?'),
),
migrations.AlterField(
model_name='document',
name='label',
field=models.CharField(blank=True, db_index=True, default='', help_text='The name of the document.', max_length=255, verbose_name='Label'),
),
migrations.AlterField(
model_name='document',
name='language',
field=models.CharField(blank=True, default=b'eng', help_text='The dominant language in the document.', max_length=8, verbose_name='Language'),
),
migrations.AlterField(
model_name='document',
name='uuid',
field=models.UUIDField(default=uuid.uuid4, editable=False, help_text='UUID of a document, universally Unique ID. An unique identifiergenerated for each document.', verbose_name='UUID'),
),
migrations.AlterField(
model_name='documenttype',
name='label',
field=models.CharField(help_text='The name of the document type.', max_length=32, unique=True, verbose_name='Label'),
),
migrations.AlterField(
model_name='documentversion',
name='checksum',
field=models.CharField(blank=True, db_index=True, editable=False, help_text="A hash/checkdigit/fingerprint generated from the document's binary data. Only identical documents will have the same checksum.", max_length=64, null=True, verbose_name='Checksum'),
),
migrations.AlterField(
model_name='documentversion',
name='comment',
field=models.TextField(blank=True, default='', help_text='An optional short text describing the document version.', verbose_name='Comment'),
),
migrations.AlterField(
model_name='documentversion',
name='encoding',
field=models.CharField(blank=True, editable=False, help_text='The document version file encoding. binary 7-bit, binary 8-bit, text, base64, etc.', max_length=64, null=True, verbose_name='Encoding'),
),
migrations.AlterField(
model_name='documentversion',
name='mimetype',
field=models.CharField(blank=True, editable=False, help_text='The document version\'s file mimetype. MIME types are a standard way to describe the format of a file, in this case the file format of the document. Some examples: "text/plain" or "image/jpeg". ', max_length=255, null=True, verbose_name='MIME type'),
),
migrations.AlterField(
model_name='documentversion',
name='timestamp',
field=models.DateTimeField(auto_now_add=True, db_index=True, help_text='The server date and time when the document version was processed.', verbose_name='Timestamp'),
),
]

View File

@@ -70,7 +70,8 @@ class DocumentType(models.Model):
properties can be attached
"""
label = models.CharField(
max_length=32, unique=True, verbose_name=_('Label')
help_text=_('The name of the document type.'), max_length=32,
unique=True, verbose_name=_('Label')
)
trash_time_period = models.PositiveIntegerField(
blank=True, help_text=_(
@@ -176,33 +177,47 @@ class Document(models.Model):
generated for each document. No two documents can ever have the same UUID.
This ID is generated automatically.
"""
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
uuid = models.UUIDField(
default=uuid.uuid4, editable=False, help_text=_(
'UUID of a document, universally Unique ID. An unique identifier'
'generated for each document.'
), verbose_name=_('UUID')
)
document_type = models.ForeignKey(
on_delete=models.CASCADE, related_name='documents', to=DocumentType,
verbose_name=_('Document type')
)
label = models.CharField(
blank=True, db_index=True, default='', max_length=255,
help_text=_('The name of the document'), verbose_name=_('Label')
help_text=_('The name of the document.'), verbose_name=_('Label')
)
description = models.TextField(
blank=True, default='', verbose_name=_('Description')
blank=True, default='', help_text=_(
'An optional short text describing a document.'
), verbose_name=_('Description')
)
date_added = models.DateTimeField(
auto_now_add=True, db_index=True, verbose_name=_('Added')
auto_now_add=True, db_index=True, help_text=_(
'The server date and time when the document was finally '
'processed and added to the system.'
), verbose_name=_('Added')
)
language = models.CharField(
blank=True, default=setting_language.value, max_length=8,
verbose_name=_('Language')
blank=True, default=setting_language.value, help_text=_(
'The dominant language in the document.'
), max_length=8, verbose_name=_('Language')
)
in_trash = models.BooleanField(
db_index=True, default=False, editable=False,
verbose_name=_('In trash?')
db_index=True, default=False, help_text=_(
'Whether or not this document is in the trash.'
), editable=False, verbose_name=_('In trash?')
)
# TODO: set editable to False
deleted_date_time = models.DateTimeField(
blank=True, editable=True, null=True,
verbose_name=_('Date and time trashed')
blank=True, editable=True, help_text=_(
'The server date and time when the document was moved to the '
'trash.'
), null=True, verbose_name=_('Date and time trashed')
)
is_stub = models.BooleanField(
db_index=True, default=True, editable=False, help_text=_(
@@ -407,10 +422,14 @@ class DocumentVersion(models.Model):
verbose_name=_('Document')
)
timestamp = models.DateTimeField(
auto_now_add=True, db_index=True, verbose_name=_('Timestamp')
auto_now_add=True, db_index=True, help_text=_(
'The server date and time when the document version was processed.'
), verbose_name=_('Timestamp')
)
comment = models.TextField(
blank=True, default='', verbose_name=_('Comment')
blank=True, default='', help_text=_(
'An optional short text describing the document version.'
), verbose_name=_('Comment')
)
# File related fields
@@ -419,16 +438,25 @@ class DocumentVersion(models.Model):
verbose_name=_('File')
)
mimetype = models.CharField(
blank=True, editable=False, max_length=255, null=True,
verbose_name=_('MIME type')
blank=True, editable=False, help_text=_(
'The document version\'s file mimetype. MIME types are a '
'standard way to describe the format of a file, in this case '
'the file format of the document. Some examples: "text/plain" '
'or "image/jpeg". '
), max_length=255, null=True, verbose_name=_('MIME type')
)
encoding = models.CharField(
blank=True, editable=False, max_length=64, null=True,
verbose_name=_('Encoding')
blank=True, editable=False, help_text=_(
'The document version file encoding. binary 7-bit, binary 8-bit, '
'text, base64, etc.'
), max_length=64, null=True, verbose_name=_('Encoding')
)
checksum = models.CharField(
blank=True, db_index=True, editable=False, max_length=64, null=True,
verbose_name=_('Checksum')
blank=True, db_index=True, editable=False, help_text=(
'A hash/checkdigit/fingerprint generated from the document\'s '
'binary data. Only identical documents will have the same '
'checksum.'
), max_length=64, null=True, verbose_name=_('Checksum')
)
class Meta:

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:45
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('metadata', '0010_auto_20180823_2353'),
]
operations = [
migrations.AlterField(
model_name='documentmetadata',
name='value',
field=models.CharField(blank=True, db_index=True, help_text='The actual value stored in the metadata type field for the document.', max_length=255, null=True, verbose_name='Value'),
),
migrations.AlterField(
model_name='metadatatype',
name='name',
field=models.CharField(help_text='Name used by other apps to reference this metadata type. Do not use python reserved words, or spaces.', max_length=48, unique=True, verbose_name='Name'),
),
]

View File

@@ -44,7 +44,7 @@ class MetadataType(models.Model):
name = models.CharField(
max_length=48,
help_text=_(
'Name used by other apps to reference this value. '
'Name used by other apps to reference this metadata type. '
'Do not use python reserved words, or spaces.'
),
unique=True, verbose_name=_('Name')
@@ -182,8 +182,10 @@ class DocumentMetadata(models.Model):
on_delete=models.CASCADE, to=MetadataType, verbose_name=_('Type')
)
value = models.CharField(
blank=True, db_index=True, max_length=255, null=True,
verbose_name=_('Value')
blank=True, db_index=True, help_text=_(
'The actual value stored in the metadata type field for '
'the document.'
), max_length=255, null=True, verbose_name=_('Value')
)
class Meta:

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:46
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ocr', '0007_auto_20170827_1617'),
]
operations = [
migrations.AlterField(
model_name='documentpageocrcontent',
name='content',
field=models.TextField(blank=True, help_text='The actual text content extracted by the OCR backend.', verbose_name='Content'),
),
]

View File

@@ -41,7 +41,11 @@ class DocumentPageOCRContent(models.Model):
on_delete=models.CASCADE, related_name='ocr_content',
to=DocumentPage, verbose_name=_('Document page')
)
content = models.TextField(blank=True, verbose_name=_('Content'))
content = models.TextField(
blank=True, help_text=_(
'The actual text content extracted by the OCR backend.'
), verbose_name=_('Content')
)
objects = DocumentPageOCRContentManager()

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-17 06:46
from __future__ import unicode_literals
import colorful.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('tags', '0007_auto_20170118_1758'),
]
operations = [
migrations.AlterField(
model_name='tag',
name='color',
field=colorful.fields.RGBColorField(help_text='The RGB color values for the tag.', verbose_name='Color'),
),
migrations.AlterField(
model_name='tag',
name='label',
field=models.CharField(db_index=True, help_text='A short text used as the tag name.', max_length=128, unique=True, verbose_name='Label'),
),
]

View File

@@ -20,9 +20,14 @@ from .widgets import widget_single_tag
@python_2_unicode_compatible
class Tag(models.Model):
label = models.CharField(
db_index=True, max_length=128, unique=True, verbose_name=_('Label')
db_index=True, help_text=_(
'A short text used as the tag name.'
), max_length=128, unique=True, verbose_name=_('Label')
)
color = RGBColorField(
help_text=_('The RGB color values for the tag.'),
verbose_name=_('Color')
)
color = RGBColorField(verbose_name=_('Color'))
documents = models.ManyToManyField(
related_name='tags', to=Document, verbose_name=_('Documents')
)