Révision 0d4bf0b4
Ajouté par Serghei Mihai il y a presque 10 ans
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) |
Formats disponibles : Unified diff
personnes: fixing the group holidays with empty services list
Closes #4171