134 self.migrationsList.header().resizeSections( |
134 self.migrationsList.header().resizeSections( |
135 QHeaderView.ResizeToContents) |
135 QHeaderView.ResizeToContents) |
136 if self.__mode == DjangoMigrationsListDialog.MigrationsListMode: |
136 if self.__mode == DjangoMigrationsListDialog.MigrationsListMode: |
137 self.migrationsList.header().setStretchLastSection(True) |
137 self.migrationsList.header().setStretchLastSection(True) |
138 |
138 |
139 def start(self, pythonExecutable, sitePath): |
139 def start(self, pythonExecutable, sitePath, databaseName): |
140 """ |
140 """ |
141 Public slot used to start the process. |
141 Public slot used to start the process. |
142 |
142 |
143 @param pythonExecutable Python executable to be used |
143 @param pythonExecutable Python executable to be used |
144 @type str |
144 @type str |
145 @param sitePath path of the site |
145 @param sitePath path of the site |
146 @type str |
146 @type str |
147 @return flag indicating a successful start of the process (boolean) |
147 @param databaseName name of the database to be used |
|
148 @type str |
|
149 @return flag indicating a successful start of the process |
|
150 @rtype bool |
148 """ |
151 """ |
149 self.__pyExe = pythonExecutable |
152 self.__pyExe = pythonExecutable |
150 self.__sitePath = sitePath |
153 self.__sitePath = sitePath |
151 |
154 |
152 self.errorGroup.hide() |
155 self.errorGroup.hide() |
164 args.append("--list") |
167 args.append("--list") |
165 else: |
168 else: |
166 args.append("--plan") |
169 args.append("--plan") |
167 args.append("--verbosity") |
170 args.append("--verbosity") |
168 args.append("2") |
171 args.append("2") |
169 # TODO: add support for --database DATABASE for Django 1.9.0+ |
172 if databaseName: |
|
173 args.append("--database={0}".format(databaseName)) |
170 |
174 |
171 self.proc.start(pythonExecutable, args) |
175 self.proc.start(pythonExecutable, args) |
172 procStarted = self.proc.waitForStarted() |
176 procStarted = self.proc.waitForStarted() |
173 if not procStarted: |
177 if not procStarted: |
174 self.buttonBox.setFocus() |
178 self.buttonBox.setFocus() |
372 for itm in self.migrationsList.selectedItems(): |
376 for itm in self.migrationsList.selectedItems(): |
373 if itm.parent() is None: |
377 if itm.parent() is None: |
374 apps.append(itm.text(0)) |
378 apps.append(itm.text(0)) |
375 |
379 |
376 if apps: |
380 if apps: |
377 migration, ok = QInputDialog.getText( |
381 if self.__django.getDjangoVersion() >= (1, 8, 0): |
378 self, |
382 migration, ok = QInputDialog.getText( |
379 self.tr("Make Migrations"), |
383 self, |
380 self.tr("Enter a name for the migrations (leave empty to" |
384 self.tr("Make Migrations"), |
381 " use system supplied name):"), |
385 self.tr("Enter a name for the migrations (leave empty to" |
382 QLineEdit.Normal) |
386 " use system supplied name):"), |
|
387 QLineEdit.Normal) |
|
388 else: |
|
389 migration = "" |
|
390 ok = True |
|
391 |
383 if ok: |
392 if ok: |
384 self.__django.makeMigrations(apps, migration, dryRun, empty) |
393 self.__django.makeMigrations(apps, migration, dryRun, empty, |
|
394 True) |
385 |
395 |
386 self.on_refreshButton_clicked() |
396 self.on_refreshButton_clicked() |