Added code to automatically add generated migrations to the eric project. eric7

Sat, 28 Dec 2024 16:01:22 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 28 Dec 2024 16:01:22 +0100
branch
eric7
changeset 203
07abb6af9048
parent 202
b06794ae2a92
child 204
ef2a6680ad2a

Added code to automatically add generated migrations to the eric project.

ChangeLog file | annotate | diff | comparison | revisions
PluginDjango.epj file | annotate | diff | comparison | revisions
PluginProjectDjango.zip file | annotate | diff | comparison | revisions
ProjectDjango/Project.py file | annotate | diff | comparison | revisions
--- a/ChangeLog	Fri Dec 27 14:17:37 2024 +0100
+++ b/ChangeLog	Sat Dec 28 16:01:22 2024 +0100
@@ -3,6 +3,7 @@
 Version 10.4.0
 - added capability to select from various template types when creating a
   new view template
+- added code to automatically add generated migrations to the eric project
 
 Version 10.3.3
 - bug fixes
--- a/PluginDjango.epj	Fri Dec 27 14:17:37 2024 +0100
+++ b/PluginDjango.epj	Sat Dec 28 16:01:22 2024 +0100
@@ -171,8 +171,11 @@
     "EMBEDDED_VENV": false,
     "EOL": 1,
     "FILETYPES": {
+      "*.cfg": "OTHERS",
       "*.epj": "OTHERS",
       "*.idl": "INTERFACES",
+      "*.ini": "OTHERS",
+      "*.json": "OTHERS",
       "*.md": "OTHERS",
       "*.proto": "PROTOCOLS",
       "*.py": "SOURCES",
@@ -181,9 +184,12 @@
       "*.pyw3": "SOURCES",
       "*.qm": "TRANSLATIONS",
       "*.rst": "OTHERS",
+      "*.toml": "OTHERS",
       "*.ts": "TRANSLATIONS",
       "*.txt": "OTHERS",
       "*.ui": "FORMS",
+      "*.yaml": "OTHERS",
+      "*.yml": "OTHERS",
       "GNUmakefile": "OTHERS",
       "Makefile": "OTHERS",
       "README": "OTHERS",
Binary file PluginProjectDjango.zip has changed
--- a/ProjectDjango/Project.py	Fri Dec 27 14:17:37 2024 +0100
+++ b/ProjectDjango/Project.py	Sat Dec 28 16:01:22 2024 +0100
@@ -8,6 +8,7 @@
 """
 
 import contextlib
+import glob
 import os
 import re
 import shutil
@@ -2869,6 +2870,17 @@
         res = dia.startProcess(args, path)
         if res:
             dia.exec()
+            if not dryRun:
+                # Append generated migrations only if no dry-run was done.
+                migrationFiles = glob.glob(
+                    os.path.join(
+                        self.__ericProject.getProjectPath(),
+                        "**/[0-9][0-9][0-9][0-9]*.py"
+                    ),
+                    recursive=True,
+                )
+                for migrationFile in migrationFiles:
+                    self.__ericProject.appendFile(migrationFile)
 
     def __squashMigrations(self):
         """

eric ide

mercurial