ProjectDjango/DjangoSquashMigrationSelectionDialog.py

changeset 125
d280acf98fb5
parent 121
2346aa3fffcc
child 142
ecadd7fd0963
--- a/ProjectDjango/DjangoSquashMigrationSelectionDialog.py	Sat Jan 27 11:46:33 2018 +0100
+++ b/ProjectDjango/DjangoSquashMigrationSelectionDialog.py	Sat Mar 24 19:11:39 2018 +0100
@@ -24,14 +24,14 @@
     """
     Class implementing a dialog to enter data needed to squash migrations.
     """
-    def __init__(self, migrations, showStart, parent=None):
+    def __init__(self, migrations, django, parent=None):
         """
         Constructor
         
         @param migrations dictionary containing the available migrations
         @type dict
-        @param showStart flag indicating to show the start migrations
-        @type bool
+        @param django reference to the Django project object
+        @type Project
         @param parent reference to the parent widget
         @type QWidget
         """
@@ -41,8 +41,9 @@
         self.__appliedIcon = QIcon(os.path.join(
             os.path.dirname(__file__), "icons", "applied.png"))
         
-        self.startLabel.setEnabled(showStart)
-        self.startMigrationComboBox.setEnabled(showStart)
+        self.__version = django.getDjangoVersion()
+        self.startMigrationComboBox.setEnabled(self.__version >= (1, 9, 0))
+        self.nameEdit.setEnabled(self.__version >= (2, 0, 0))
         
         self.__migrations = migrations
         self.applicationComboBox.addItems(
@@ -104,10 +105,15 @@
             startMigration = self.startMigrationComboBox.currentText()
         else:
             startMigration = ""
+        if self.nameEdit.isEnabled():
+            name = self.nameEdit.text()
+        else:
+            name = ""
         
         return (
             self.applicationComboBox.currentText(),
             startMigration,
             self.endMigrationComboBox.currentText(),
             self.noOptimizeCheckBox.isChecked(),
+            name
         )

eric ide

mercurial