mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-07-30 18:27:45 -05:00
removed matching model fields, automatic classifier reloading, added autmatic_classification field to matching model
This commit is contained in:
77
src/documents/migrations/0024_auto_20180904_1425.py
Executable file
77
src/documents/migrations/0024_auto_20180904_1425.py
Executable file
@@ -0,0 +1,77 @@
|
||||
# Generated by Django 2.0.8 on 2018-09-04 14:25
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def transfer_automatic_classification(apps, schema_editor):
|
||||
for model_name in ["Tag", "Correspondent", "DocumentType"]:
|
||||
model_class = apps.get_model("documents", model_name)
|
||||
for o in model_class.objects.all():
|
||||
o.automatic_classification = o.match is not None and len(o.match) > 0
|
||||
o.save()
|
||||
|
||||
|
||||
def reverse_automatic_classification(apps, schema_editor):
|
||||
pass
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('documents', '0023_auto_20180823_1155'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='correspondent',
|
||||
name='automatic_classification',
|
||||
field=models.BooleanField(default=False, help_text='Automatically assign to newly added documents based on current usage in your document collection.'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='documenttype',
|
||||
name='automatic_classification',
|
||||
field=models.BooleanField(default=False, help_text='Automatically assign to newly added documents based on current usage in your document collection.'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='tag',
|
||||
name='automatic_classification',
|
||||
field=models.BooleanField(default=False, help_text='Automatically assign to newly added documents based on current usage in your document collection.'),
|
||||
),
|
||||
migrations.RunPython(transfer_automatic_classification, reverse_automatic_classification),
|
||||
migrations.RemoveField(
|
||||
model_name='correspondent',
|
||||
name='is_insensitive',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='correspondent',
|
||||
name='match',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='correspondent',
|
||||
name='matching_algorithm',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='documenttype',
|
||||
name='is_insensitive',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='documenttype',
|
||||
name='match',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='documenttype',
|
||||
name='matching_algorithm',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='tag',
|
||||
name='is_insensitive',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='tag',
|
||||
name='match',
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='tag',
|
||||
name='matching_algorithm',
|
||||
),
|
||||
]
|
Reference in New Issue
Block a user