Další pokus o migraci, I guess (po týdnu, lol)
This commit is contained in:
		
							parent
							
								
									457236c21a
								
							
						
					
					
						commit
						a23daf8b97
					
				
					 1 changed files with 12 additions and 0 deletions
				
			
		|  | @ -5,6 +5,17 @@ import django.utils.timezone | ||||||
| import django_countries.fields | import django_countries.fields | ||||||
| import imagekit.models.fields | import imagekit.models.fields | ||||||
| 
 | 
 | ||||||
|  | def nastav_nove_contenttypes(apps, schema_editor): | ||||||
|  |     ContentType = apps.get_model('contenttypes', 'ContentType') | ||||||
|  |     for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): | ||||||
|  |         oct = ContentType.objects.filter(app_label='seminar', model=m) | ||||||
|  |         oct.update(app_label='personalni') | ||||||
|  | 
 | ||||||
|  | def nastav_stare_contenttypes(apps, schema_editor): | ||||||
|  |     ContentType = apps.get_model('contenttypes', 'ContentType') | ||||||
|  |     for m in ('resitel', 'organizator', 'osoba', 'skola', 'prijemce'): | ||||||
|  |         nct = ContentType.objects.filter(app_label='personalni', model=m) | ||||||
|  |         nct.update(app_label='seminar') | ||||||
| 
 | 
 | ||||||
| class Migration(migrations.Migration): | class Migration(migrations.Migration): | ||||||
| 
 | 
 | ||||||
|  | @ -16,6 +27,7 @@ class Migration(migrations.Migration): | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
|     operations = [ |     operations = [ | ||||||
|  |         migrations.RunPython(nastav_nove_contenttypes, nastav_stare_contenttypes), | ||||||
|         migrations.CreateModel( |         migrations.CreateModel( | ||||||
|             name='Organizator', |             name='Organizator', | ||||||
|             fields=[ |             fields=[ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel 'LEdoian' Turinsky
						Pavel 'LEdoian' Turinsky