ProjectDjango/DjangoMakeMigrationsDialog.py

Sun, 31 Dec 2017 16:59:10 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 31 Dec 2017 16:59:10 +0100
changeset 121
2346aa3fffcc
parent 104
4cd211a73b3e
child 125
d280acf98fb5
permissions
-rw-r--r--

Updated copyright for 2018.

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

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

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

from __future__ import unicode_literals

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(DjangoMakeMigrationsDialog, self).__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 and a flag for an empty migration
        @rtype tuple of (str, str, bool, bool)
        """
        return (
            self.applicationsComboBox.currentText(),
            self.nameEdit.text(),
            self.dryrunCheckBox.isChecked(),
            self.emptyCheckBox.isChecked(),
        )

eric ide

mercurial