mirror of
				https://github.com/retspen/webvirtcloud
				synced 2025-07-31 12:41:08 +00:00 
			
		
		
		
	Fixe migrations for new deployments
This commit is contained in:
		
							parent
							
								
									e4e79d3d4b
								
							
						
					
					
						commit
						85929b5327
					
				
					 11 changed files with 88 additions and 104 deletions
				
			
		|  | @ -1,23 +0,0 @@ | |||
| # Generated by Django 2.2.10 on 2020-01-28 07:01 | ||||
| 
 | ||||
| from django.db import migrations | ||||
| 
 | ||||
| 
 | ||||
| def add_useradmin(apps, schema_editor): | ||||
|     from django.utils import timezone | ||||
|     from django.contrib.auth.models import User | ||||
|     from accounts.models import UserAttributes | ||||
| 
 | ||||
|     admin = User.objects.create_superuser('admin', None, 'admin', last_login=timezone.now()) | ||||
|     UserAttributes(user=admin, max_instances=-1, max_cpus=-1, max_memory=-1, max_disk_size=-1).save() | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('accounts', '0001_initial'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.RunPython(add_useradmin), | ||||
|     ] | ||||
|  | @ -6,7 +6,7 @@ from django.db import migrations, models | |||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('accounts', '0002_addAdmin'), | ||||
|         ('accounts', '0001_initial'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|  | @ -16,7 +16,7 @@ class Migration(migrations.Migration): | |||
|                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||||
|             ], | ||||
|             options={ | ||||
|                 'permissions': (('change_password', 'Can change password'),), | ||||
|                 'permissions': (('change_password', 'Can change password'), ), | ||||
|                 'managed': False, | ||||
|                 'default_permissions': (), | ||||
|             }, | ||||
|  | @ -1,25 +0,0 @@ | |||
| from django.db import migrations | ||||
| 
 | ||||
| 
 | ||||
| def apply_change_password(apps, schema_editor): | ||||
|     from django.conf import settings | ||||
|     from django.contrib.auth.models import User, Permission | ||||
| 
 | ||||
|     if hasattr(settings, 'SHOW_PROFILE_EDIT_PASSWORD'): | ||||
|         if settings.SHOW_PROFILE_EDIT_PASSWORD: | ||||
|             permission = Permission.objects.get(codename='change_password') | ||||
|             users = User.objects.all() | ||||
|             user: User | ||||
|             for user in users: | ||||
|                 user.user_permissions.add(permission) | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('accounts', '0003_permissionset'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.RunPython(apply_change_password), | ||||
|     ] | ||||
|  | @ -1,18 +0,0 @@ | |||
| # Generated by Django 2.2.12 on 2020-05-28 04:24 | ||||
| 
 | ||||
| from django.db import migrations | ||||
| 
 | ||||
| 
 | ||||
| class Migration(migrations.Migration): | ||||
| 
 | ||||
|     dependencies = [ | ||||
|         ('accounts', '0004_apply_change_password'), | ||||
|         ('instances', '0003_migrate_can_clone_instances'), | ||||
|     ] | ||||
| 
 | ||||
|     operations = [ | ||||
|         migrations.RemoveField( | ||||
|             model_name='userattributes', | ||||
|             name='can_clone_instances', | ||||
|         ), | ||||
|     ] | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue