Project

General

Profile

« Previous | Next » 

Revision 0d4bf0b4

Added by Serghei Mihai almost 10 years ago

personnes: fixing the group holidays with empty services list

Closes #4171

View differences:

calebasse/personnes/management/commands/fix-group-holiday-services.py
1
from django.core.management.base import BaseCommand, CommandError
2

  
3
class Command(BaseCommand):
4

  
5
    def handle(self, *args, **kwargs):
6
        from calebasse.personnes.models import Holiday
7
        from calebasse.ressources.models import Service
8

  
9
        all_services = list(Service.objects.all())
10

  
11
        for holiday in Holiday.objects.filter(services__isnull=True):
12
            for service in all_services:
13
                holiday.services.add(service)

Also available in: Unified diff