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 migrations
|
||||
|
||||
@@ -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 migrations
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
@@ -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,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
|
||||
@@ -15,13 +14,25 @@ class Migration(migrations.Migration):
|
||||
migrations.AddField(
|
||||
model_name='emailbasemodel',
|
||||
name='from_metadata_type',
|
||||
field=models.ForeignKey(related_name='email_from', blank=True, to='metadata.MetadataType', help_text='Select a metadata type valid for the document type selected in which to store the email\'s "from" value.', null=True, verbose_name='From metadata type'),
|
||||
field=models.ForeignKey(
|
||||
related_name='email_from', blank=True,
|
||||
to='metadata.MetadataType',
|
||||
help_text='Select a metadata type valid for the document '
|
||||
'type selected in which to store the email\'s "from" value.',
|
||||
null=True, verbose_name='From metadata type'
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='emailbasemodel',
|
||||
name='subject_metadata_type',
|
||||
field=models.ForeignKey(related_name='email_subject', blank=True, to='metadata.MetadataType', help_text="Select a metadata type valid for the document type selected in which to store the email's subject.", null=True, verbose_name='Subject metadata type'),
|
||||
field=models.ForeignKey(
|
||||
related_name='email_subject', blank=True,
|
||||
to='metadata.MetadataType', help_text="Select a metadata "
|
||||
"type valid for the document type selected in which to store "
|
||||
"the email's subject.", null=True,
|
||||
verbose_name='Subject metadata type'
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
@@ -14,13 +13,21 @@ class Migration(migrations.Migration):
|
||||
migrations.AddField(
|
||||
model_name='emailbasemodel',
|
||||
name='store_body',
|
||||
field=models.BooleanField(default=True, help_text='Store the body of the email as a text document.', verbose_name='Store email body'),
|
||||
field=models.BooleanField(
|
||||
default=True,
|
||||
help_text='Store the body of the email as a text document.',
|
||||
verbose_name='Store email body'
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='imapemail',
|
||||
name='mailbox',
|
||||
field=models.CharField(default='INBOX', help_text='IMAP Mailbox from which to check for messages.', max_length=64, verbose_name='Mailbox'),
|
||||
field=models.CharField(
|
||||
default='INBOX',
|
||||
help_text='IMAP Mailbox from which to check for messages.',
|
||||
max_length=64, verbose_name='Mailbox'
|
||||
),
|
||||
preserve_default=True,
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-05 04:19
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-05 07:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@@ -26,7 +24,9 @@ class Migration(migrations.Migration):
|
||||
model_name='sanescanner',
|
||||
name='resolution',
|
||||
field=models.PositiveIntegerField(
|
||||
default=300, help_text='Sets the resolution of the scanned image in DPI (dots per inch).',
|
||||
default=300,
|
||||
help_text='Sets the resolution of the scanned image in '
|
||||
'DPI (dots per inch).',
|
||||
verbose_name='Resolution'
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-06 07:10
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-06 07:22
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-02-06 08:35
|
||||
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-06-30 20:40
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@@ -15,6 +13,12 @@ class Migration(migrations.Migration):
|
||||
migrations.AlterField(
|
||||
model_name='sanescanner',
|
||||
name='resolution',
|
||||
field=models.PositiveIntegerField(blank=True, help_text='Sets the resolution of the scanned image in DPI (dots per inch). Typical value is 200. If this option is not supported by your scanner, leave it blank.', null=True, verbose_name='Resolution'),
|
||||
field=models.PositiveIntegerField(
|
||||
blank=True,
|
||||
help_text='Sets the resolution of the scanned image in '
|
||||
'DPI (dots per inch). Typical value is 200. If this option '
|
||||
'is not supported by your scanner, leave it blank.',
|
||||
null=True, verbose_name='Resolution'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.11 on 2018-05-10 21:51
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@@ -15,6 +13,15 @@ class Migration(migrations.Migration):
|
||||
migrations.AlterField(
|
||||
model_name='sanescanner',
|
||||
name='source',
|
||||
field=models.CharField(blank=True, choices=[('flatbed', 'Flatbed'), ('Automatic Document Feeder', 'Document feeder')], help_text='Selects the scan source (such as a document-feeder). If this option is not supported by your scanner, leave it blank.', max_length=32, null=True, verbose_name='Paper source'),
|
||||
field=models.CharField(
|
||||
blank=True, choices=[
|
||||
('flatbed', 'Flatbed'),
|
||||
('Automatic Document Feeder', 'Document feeder')
|
||||
],
|
||||
help_text='Selects the scan source (such as a '
|
||||
'document-feeder). If this option is not supported by your '
|
||||
'scanner, leave it blank.', max_length=32, null=True,
|
||||
verbose_name='Paper source'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.11 on 2018-06-08 00:57
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@@ -15,6 +13,13 @@ class Migration(migrations.Migration):
|
||||
migrations.AlterField(
|
||||
model_name='sanescanner',
|
||||
name='adf_mode',
|
||||
field=models.CharField(blank=True, choices=[('simplex', 'Simplex'), ('duplex', 'Duplex')], help_text='Selects the document feeder mode (simplex/duplex). If this option is not supported by your scanner, leave it blank.', max_length=16, verbose_name='ADF mode'),
|
||||
field=models.CharField(
|
||||
blank=True, choices=[
|
||||
('simplex', 'Simplex'), ('duplex', 'Duplex')
|
||||
],
|
||||
help_text='Selects the document feeder mode (simplex/duplex). '
|
||||
'If this option is not supported by your scanner, leave it '
|
||||
'blank.', max_length=16, verbose_name='ADF mode'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.11 on 2018-08-03 04:40
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def make_labels_unique(apps, schema_editor):
|
||||
Source = apps.get_model('sources', 'Source')
|
||||
def operation_make_labels_unique(apps, schema_editor):
|
||||
Source = apps.get_model(app_label='sources', model_name='Source')
|
||||
|
||||
for source in Source.objects.using(schema_editor.connection.alias).all():
|
||||
# Look for sources with the same label
|
||||
duplicate_queryset = Source.objects.using(schema_editor.connection.alias).filter(label=source.label).exclude(pk=source.pk)
|
||||
duplicate_queryset = Source.objects.using(
|
||||
schema_editor.connection.alias
|
||||
).filter(label=source.label).exclude(pk=source.pk)
|
||||
if duplicate_queryset:
|
||||
# If a duplicate is found, append the id to the original source
|
||||
# label
|
||||
@@ -18,8 +18,8 @@ def make_labels_unique(apps, schema_editor):
|
||||
source.save()
|
||||
|
||||
|
||||
def make_labels_unique_reverse(apps, schema_editor):
|
||||
Source = apps.get_model('sources', 'Source')
|
||||
def operation_make_labels_unique_reverse(apps, schema_editor):
|
||||
Source = apps.get_model(app_label='sources', model_name='Source')
|
||||
|
||||
for source in Source.objects.using(schema_editor.connection.alias).all():
|
||||
if source.label.endswith('__{}'.format(source.pk)):
|
||||
@@ -35,11 +35,14 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(
|
||||
make_labels_unique, reverse_code=make_labels_unique_reverse
|
||||
code=operation_make_labels_unique,
|
||||
reverse_code=operation_make_labels_unique_reverse
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='source',
|
||||
name='label',
|
||||
field=models.CharField(db_index=True, max_length=64, unique=True, verbose_name='Label'),
|
||||
field=models.CharField(
|
||||
db_index=True, max_length=64, unique=True, verbose_name='Label'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.16 on 2018-11-28 07:52
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@@ -15,12 +13,19 @@ class Migration(migrations.Migration):
|
||||
migrations.AddField(
|
||||
model_name='watchfoldersource',
|
||||
name='include_subdirectories',
|
||||
field=models.BooleanField(default=False, help_text='If checked, not only will the folder path be scanned for files but also its subdirectories.', verbose_name='Include subdirectories?'),
|
||||
field=models.BooleanField(
|
||||
default=False, help_text='If checked, not only will the '
|
||||
'folder path be scanned for files but also its '
|
||||
'subdirectories.', verbose_name='Include subdirectories?'
|
||||
),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='watchfoldersource',
|
||||
name='folder_path',
|
||||
field=models.CharField(help_text='Server side filesystem path to scan for files.', max_length=255, verbose_name='Folder path'),
|
||||
field=models.CharField(
|
||||
help_text='Server side filesystem path to scan for files.',
|
||||
max_length=255, verbose_name='Folder path'
|
||||
),
|
||||
),
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user