On n'a plus besoin de pause
This commit is contained in:
		
							
								
								
									
										38
									
								
								src/agenda_culturel/migrations/0143_fb_nopause.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/agenda_culturel/migrations/0143_fb_nopause.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
# Generated by Django 4.2.9 on 2025-02-02 17:37
 | 
			
		||||
 | 
			
		||||
from django.db import migrations
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def fb_nopause(apps, schema_editor):
 | 
			
		||||
    RecurrentImport = apps.get_model("agenda_culturel", "RecurrentImport")
 | 
			
		||||
 | 
			
		||||
    rimports = RecurrentImport.objects.filter(processor="Facebook events").all()
 | 
			
		||||
 | 
			
		||||
    for r in rimports:
 | 
			
		||||
        r.downloader = "chromium headless"
 | 
			
		||||
    
 | 
			
		||||
    RecurrentImport.objects.bulk_update(rimports, fields=["downloader"])
 | 
			
		||||
 | 
			
		||||
def fb_nopause_backward(apps, schema_editor):
 | 
			
		||||
    RecurrentImport = apps.get_model("agenda_culturel", "RecurrentImport")
 | 
			
		||||
 | 
			
		||||
    rimports = RecurrentImport.objects.filter(processor="Facebook events").all()
 | 
			
		||||
 | 
			
		||||
    for r in rimports:
 | 
			
		||||
        r.downloader = "chromium (pause)"
 | 
			
		||||
    
 | 
			
		||||
    RecurrentImport.objects.bulk_update(rimports, fields=["downloader"])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('agenda_culturel', '0142_alter_recurrentimport_processor'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.RunPython(
 | 
			
		||||
            fb_nopause,
 | 
			
		||||
            fb_nopause_backward,
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
		Reference in New Issue
	
	Block a user