mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-29 13:48:09 -06:00
* Chore(deps): Bump the small-changes group across 1 directory with 3 updates Bumps the small-changes group with 3 updates in the / directory: [ocrmypdf](https://github.com/ocrmypdf/OCRmyPDF), [mkdocs-material](https://github.com/squidfunk/mkdocs-material) and [ruff](https://github.com/astral-sh/ruff). Updates `ocrmypdf` from 16.10.4 to 16.11.0 - [Release notes](https://github.com/ocrmypdf/OCRmyPDF/releases) - [Changelog](https://github.com/ocrmypdf/OCRmyPDF/blob/main/docs/release_notes.md) - [Commits](https://github.com/ocrmypdf/OCRmyPDF/compare/v16.10.4...v16.11.0) Updates `mkdocs-material` from 9.6.19 to 9.6.20 - [Release notes](https://github.com/squidfunk/mkdocs-material/releases) - [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG) - [Commits](https://github.com/squidfunk/mkdocs-material/compare/9.6.19...9.6.20) Updates `ruff` from 0.12.12 to 0.13.0 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.12.12...0.13.0) --- updated-dependencies: - dependency-name: ocrmypdf dependency-version: 16.11.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: small-changes - dependency-name: mkdocs-material dependency-version: 9.6.20 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: small-changes - dependency-name: ruff dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: small-changes ... Signed-off-by: dependabot[bot] <support@github.com> * Applies the new Ruff rule for unpacking --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Trenton H <797416+stumpylog@users.noreply.github.com>
71 lines
2.1 KiB
Python
71 lines
2.1 KiB
Python
# Generated by Django 1.9 on 2016-01-11 12:21
|
|
|
|
import django.db.models.deletion
|
|
from django.db import migrations
|
|
from django.db import models
|
|
from django.template.defaultfilters import slugify
|
|
|
|
DOCUMENT_SENDER_MAP = {}
|
|
|
|
|
|
def move_sender_strings_to_sender_model(apps, schema_editor):
|
|
sender_model = apps.get_model("documents", "Sender")
|
|
document_model = apps.get_model("documents", "Document")
|
|
|
|
# Create the sender and log the relationship with the document
|
|
for document in document_model.objects.all():
|
|
if document.sender:
|
|
(
|
|
DOCUMENT_SENDER_MAP[document.pk],
|
|
_,
|
|
) = sender_model.objects.get_or_create(
|
|
name=document.sender,
|
|
defaults={"slug": slugify(document.sender)},
|
|
)
|
|
|
|
|
|
def realign_senders(apps, schema_editor):
|
|
document_model = apps.get_model("documents", "Document")
|
|
for pk, sender in DOCUMENT_SENDER_MAP.items():
|
|
document_model.objects.filter(pk=pk).update(sender=sender)
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("documents", "0002_auto_20151226_1316"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name="Sender",
|
|
fields=[
|
|
(
|
|
"id",
|
|
models.AutoField(
|
|
auto_created=True,
|
|
primary_key=True,
|
|
serialize=False,
|
|
verbose_name="ID",
|
|
),
|
|
),
|
|
("name", models.CharField(max_length=128, unique=True)),
|
|
("slug", models.SlugField()),
|
|
],
|
|
),
|
|
migrations.RunPython(move_sender_strings_to_sender_model),
|
|
migrations.RemoveField(
|
|
model_name="document",
|
|
name="sender",
|
|
),
|
|
migrations.AddField(
|
|
model_name="document",
|
|
name="sender",
|
|
field=models.ForeignKey(
|
|
blank=True,
|
|
on_delete=django.db.models.deletion.CASCADE,
|
|
to="documents.Sender",
|
|
),
|
|
),
|
|
migrations.RunPython(realign_senders),
|
|
]
|