ProjectDjango/DjangoMakeMigrationsDialog.py

Sat, 24 Apr 2021 11:25:03 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 24 Apr 2021 11:25:03 +0200
changeset 169
b8f263e05c39
parent 168
c6182aab51e9
child 172
ea7980ded4f3
permissions
-rw-r--r--

- implemented some code simplifications
- dropped support for Django < 2.0.0

# -*- coding: utf-8 -*-

# Copyright (c) 2016 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to enter the data needed to make migrations.
"""

from PyQt5.QtWidgets import QDialog

from .Ui_DjangoMakeMigrationsDialog import Ui_DjangoMakeMigrationsDialog


class DjangoMakeMigrationsDialog(QDialog, Ui_DjangoMakeMigrationsDialog):
    """
    Class implementing a dialog to enter the data needed to make migrations.
    """
    def __init__(self, recentApps, parent=None):
        """
        Constructor
        
        @param recentApps list of recently entered applications
        @type list of str
        @param parent reference to the parent widget
        @type QWidget
        """
        super().__init__(parent)
        self.setupUi(self)
        
        self.applicationsComboBox.addItems(recentApps)
    
    def getData(self):
        """
        Public method to get the data for the migration.
        
        @return tuple containing the application names, a migration name,
            the dry-run flag, a flag for an empty migration and a flag
            indicating to fix migration conflicts
        @rtype tuple of (str, str, bool, bool, bool)
        """
        return (
            self.applicationsComboBox.currentText(),
            self.nameEdit.text(),
            self.dryrunCheckBox.isChecked(),
            self.emptyCheckBox.isChecked(),
            self.mergeCheckBox.isChecked(),
        )

eric ide

mercurial