Code cleanups
PEP8 cleanups. Add keyword arguments. Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def move_content_from_documents_to_ocr_app(apps, schema_editor):
|
||||
DocumentPage = apps.get_model('documents', 'DocumentPage')
|
||||
DocumentPageContent = apps.get_model('ocr', 'DocumentPageContent')
|
||||
def operation_move_content_from_documents_to_ocr_app(apps, schema_editor):
|
||||
DocumentPage = apps.get_model(
|
||||
app_label='documents', model_name='DocumentPage'
|
||||
)
|
||||
DocumentPageContent = apps.get_model(
|
||||
app_label='ocr', model_name='DocumentPageContent'
|
||||
)
|
||||
|
||||
for document_page in DocumentPage.objects.using(schema_editor.connection.alias).all():
|
||||
DocumentPageContent.objects.using(schema_editor.connection.alias).create(
|
||||
@@ -22,5 +25,7 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(move_content_from_documents_to_ocr_app),
|
||||
migrations.RunPython(
|
||||
code=operation_move_content_from_documents_to_ocr_app
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
|
||||
|
||||
def create_ocr_setting_for_existing_document_types(apps, schema_editor):
|
||||
DocumentType = apps.get_model('documents', 'DocumentType')
|
||||
DocumentTypeSettings = apps.get_model('ocr', 'DocumentTypeSettings')
|
||||
def operation_create_ocr_setting_for_existing_document_types(apps, schema_editor):
|
||||
DocumentType = apps.get_model(
|
||||
app_label='documents', model_name='DocumentType'
|
||||
)
|
||||
DocumentTypeSettings = apps.get_model(
|
||||
app_label='ocr', model_name='DocumentTypeSettings'
|
||||
)
|
||||
|
||||
for document_type in DocumentType.objects.using(schema_editor.connection.alias).all():
|
||||
try:
|
||||
@@ -55,5 +58,7 @@ class Migration(migrations.Migration):
|
||||
},
|
||||
bases=(models.Model,),
|
||||
),
|
||||
migrations.RunPython(create_ocr_setting_for_existing_document_types),
|
||||
migrations.RunPython(
|
||||
code=operation_create_ocr_setting_for_existing_document_types
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-06-30 18:46
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-08-23 05:53
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-08-27 16:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- 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
|
||||
@@ -15,6 +13,9 @@ class Migration(migrations.Migration):
|
||||
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'),
|
||||
field=models.TextField(
|
||||
blank=True, help_text='The actual text content extracted by '
|
||||
'the OCR backend.', verbose_name='Content'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user