0001-personnes-fixing-the-group-holidays-with-empty-servi.patch
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) |
|
0 |
- |