Skip to content

Commit

Permalink
Merge pull request #791 from MTES-MCT/fix-migrations
Browse files Browse the repository at this point in the history
fix(test): remove dependency to s3
  • Loading branch information
alexisig authored Dec 10, 2024
2 parents cc3a0db + ba29a23 commit cc1ff49
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions diagnostic_word/migrations/0002_auto_20230224_1314.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,13 @@
# Generated by Django 3.2.18 on 2023-02-24 13:14

from typing import Callable

from django.db import migrations

from config.storages import DefaultStorage


def forwards(apps, schema_editor):
WordTemplate: Callable = apps.get_model("diagnostic_word", "WordTemplate") # type: ignore
WordTemplate.objects.create(
slug="template-bilan-1",
description="Modèle Word pour générer le diagnostic téléchargeable",
filename_mask="{diagnostic_name} - {start_date} à {end_date} - issu de SPARTE.docx",
docx=DefaultStorage().open("word_templates/Modèle_de_portrait_v17.docx"),
)


def backwards(apps, schema_editor):
WordTemplate: Callable = apps.get_model("diagnostic_word", "WordTemplate") # type: ignore
WordTemplate.objects.filter(slug="template-bilan-1").delete()


class Migration(migrations.Migration):
dependencies = [
("diagnostic_word", "0001_initial"),
]

operations = [
migrations.RunPython(forwards, reverse_code=backwards),
migrations.RunSQL(
"DROP TABLE IF EXISTS django_docx_template_docxtemplate;",
reverse_sql=migrations.RunSQL.noop,
Expand Down

0 comments on commit cc1ff49

Please sign in to comment.