ProjectDjango/DjangoSquashMigrationSelectionDialog.py

changeset 169
b8f263e05c39
parent 168
c6182aab51e9
child 172
ea7980ded4f3
--- a/ProjectDjango/DjangoSquashMigrationSelectionDialog.py	Wed Dec 30 11:02:06 2020 +0100
+++ b/ProjectDjango/DjangoSquashMigrationSelectionDialog.py	Sat Apr 24 11:25:03 2021 +0200
@@ -36,17 +36,13 @@
         @param parent reference to the parent widget
         @type QWidget
         """
-        super(DjangoSquashMigrationSelectionDialog, self).__init__(parent)
+        super().__init__(parent)
         self.setupUi(self)
         
         self.__appliedIcon = QIcon(os.path.join(
             os.path.dirname(__file__), "icons", "applied-{0}".format(suffix)
         ))
         
-        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(
             [""] + sorted(self.__migrations.keys()))
@@ -103,14 +99,12 @@
             the end migration and a flag indicating no optimization is wanted
         @rtype tuple of three str and a bool
         """
-        if self.startMigrationComboBox.isEnabled():
-            startMigration = self.startMigrationComboBox.currentText()
-        else:
-            startMigration = ""
-        if self.nameEdit.isEnabled():
-            name = self.nameEdit.text()
-        else:
-            name = ""
+        startMigration = (
+            self.startMigrationComboBox.currentText()
+            if self.startMigrationComboBox.isEnabled() else
+            ""
+        )
+        name = self.nameEdit.text() if self.nameEdit.isEnabled() else ""
         
         return (
             self.applicationComboBox.currentText(),

eric ide

mercurial