2419 Private slot to generate migrations for the Django project. |
2419 Private slot to generate migrations for the Django project. |
2420 """ |
2420 """ |
2421 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog |
2421 from .DjangoMakeMigrationsDialog import DjangoMakeMigrationsDialog |
2422 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications()) |
2422 dlg = DjangoMakeMigrationsDialog(self.getRecentApplications()) |
2423 if dlg.exec_() == QDialog.Accepted: |
2423 if dlg.exec_() == QDialog.Accepted: |
2424 apps, migration, dryRun = dlg.getData() |
2424 apps, migration, dryRun, empty = dlg.getData() |
2425 if apps: |
2425 if apps: |
2426 self.setMostRecentApplication(apps) |
2426 self.setMostRecentApplication(apps) |
2427 apps = apps.split() |
2427 apps = apps.split() |
2428 self.makeMigrations(apps, migration, dryRun) |
2428 self.makeMigrations(apps, migration, dryRun, empty) |
2429 |
2429 |
2430 def makeMigrations(self, apps, migration=None, dryRun=False): |
2430 def makeMigrations(self, apps, migration=None, dryRun=False, empty=False): |
2431 """ |
2431 """ |
2432 Public method to generate migrations. |
2432 Public method to generate migrations. |
2433 |
2433 |
2434 @param apps list of application names to generate migrations for |
2434 @param apps list of application names to generate migrations for |
2435 @type list of str |
2435 @type list of str |
2436 @param migration name of the migration to generate |
2436 @param migration name of the migration to generate |
2437 @type str |
2437 @type str |
2438 @param dryRun flag indicating a dry run |
2438 @param dryRun flag indicating a dry run |
|
2439 @type bool |
|
2440 @param empty flag indicating the creation of an empty migration |
2439 @type bool |
2441 @type bool |
2440 """ |
2442 """ |
2441 title = self.tr("Make Migrations") |
2443 title = self.tr("Make Migrations") |
2442 |
2444 |
2443 try: |
2445 try: |
2452 if migration: |
2454 if migration: |
2453 args.append("--name") |
2455 args.append("--name") |
2454 args.append(migration.replace(" ", "_")) |
2456 args.append(migration.replace(" ", "_")) |
2455 if dryRun: |
2457 if dryRun: |
2456 args.append("--dry-run") |
2458 args.append("--dry-run") |
|
2459 if empty: |
|
2460 args.append("--empty") |
2457 if apps: |
2461 if apps: |
2458 args += apps |
2462 args += apps |
2459 |
2463 |
2460 dia = DjangoDialog(title, showInput=True) |
2464 dia = DjangoDialog(title, showInput=True) |
2461 res = dia.startProcess(args, path) |
2465 res = dia.startProcess(args, path) |