ProjectDjango/Project.py

changeset 82
fc196e739797
parent 80
34b6482eb9f6
child 85
7c79dead3a86
--- a/ProjectDjango/Project.py	Wed Dec 21 12:17:47 2016 +0100
+++ b/ProjectDjango/Project.py	Wed Dec 21 12:19:31 2016 +0100
@@ -306,20 +306,6 @@
         """
         Private method to define the database related actions.
         """
-        self.syncDatabaseAct = E5Action(
-            self.tr('Synchronize'),
-            self.tr('&Synchronize'),
-            0, 0,
-            self, 'django_database_syncdb')
-        self.syncDatabaseAct.setStatusTip(self.tr(
-            'Synchronizes the database'))
-        self.syncDatabaseAct.setWhatsThis(self.tr(
-            """<b>Synchronize</b>"""
-            """<p>Synchronizes the database.</p>"""
-        ))
-        self.syncDatabaseAct.triggered.connect(self.__databaseSynchronize)
-        self.actions.append(self.syncDatabaseAct)
-        
         self.inspectDatabaseAct = E5Action(
             self.tr('Introspect'),
             self.tr('&Introspect'),
@@ -862,9 +848,6 @@
         menu = QMenu(self.tr("&Database"), self.__ui)
         menu.setTearOffEnabled(True)
         
-        if self.getDjangoVersion() < (1, 7, 0):
-            menu.addAction(self.syncDatabaseAct)
-            menu.addSeparator()
         menu.addAction(self.inspectDatabaseAct)
         menu.addSeparator()
         menu.addAction(self.flushDatabaseAct)
@@ -1438,7 +1421,7 @@
         Private slot to show some info about Django.
         """
         version = self.getDjangoVersionString()
-        url = "http://www.djangoproject.com"
+        url = "https://www.djangoproject.com"
         
         msgBox = E5MessageBox.E5MessageBox(
             E5MessageBox.Question,
@@ -1617,6 +1600,19 @@
     ## slots below implement creation functions
     ##################################################################
     
+    def newProjectCreated(self):
+        """
+        Public slot to finish up the newly generated project.
+        """
+        if self.__e5project.getProjectType() == "Django":
+            ppath = self.__e5project.getProjectPath()
+            
+            # get rid of an __init__.py file because it would be in our way
+            initModule = os.path.join(ppath, "__init__.py")
+            if os.path.exists(initModule):
+                self.__e5project.deleteFile("__init__.py")
+                self.__e5project.saveProject()
+    
     def startProjectOrApplication(self):
         """
         Public slot to start a new Django project or application.
@@ -2018,31 +2014,6 @@
     ## slots below implement database related functions
     ##################################################################
     
-    def __databaseSynchronize(self):
-        """
-        Private slot to synchronize the database.
-        """
-        consoleCmd = self.__isSpawningConsole(
-            self.__plugin.getPreferences("ConsoleCommandNoClose"))[1]
-        if consoleCmd:
-            args = Utilities.parseOptionString(consoleCmd)
-            args[0] = Utilities.getExecutablePath(args[0])
-            args.append(self.__getPythonExecutable())
-            args.append("manage.py")
-            args.append("syncdb")
-            try:
-                wd = self.__sitePath()
-                self.__adjustWorkingDirectory(args, wd)
-                started, pid = QProcess.startDetached(args[0], args[1:], wd)
-                if not started:
-                    E5MessageBox.critical(
-                        None,
-                        self.tr('Process Generation Error'),
-                        self.tr('The Django process could not be'
-                                ' started.'))
-            except DjangoNoSiteSelectedException:
-                pass
-    
     def __databaseInspect(self):
         """
         Private slot to introspect the database and output a Django model
@@ -2164,6 +2135,8 @@
         """
         Private slot to print the CREATE TABLE SQL statements for one
         or more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Create Tables"), "sql")
     
@@ -2171,6 +2144,8 @@
         """
         Private slot to print the CREATE INDEX SQL statements for one
         or more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Create Indexes"), "sqlindexes")
     
@@ -2178,6 +2153,8 @@
         """
         Private slot to print the CREATE TABLE, custom SQL and
         CREATE INDEX SQL statements for one or more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Create Everything"), "sqlall")
     
@@ -2185,6 +2162,8 @@
         """
         Private slot to print the custom table modifying SQL statements
         for one or more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Custom Statements"), "sqlcustom")
     
@@ -2192,6 +2171,8 @@
         """
         Private slot to print the DROP TABLE SQL statements for one or
         more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Drop Tables"), "sqlclear")
     
@@ -2199,6 +2180,8 @@
         """
         Private slot to print the DROP INDEX SQL statements for one or
         more applications.
+        
+        Note: available before Django v1.9.0
         """
         self.__sqlCommand(self.tr("Drop Indexes"), "sqldropindexes")
     

eric ide

mercurial