add filter by exist Establishments

This commit is contained in:
Dmitriy Kuzmenko 2019-11-02 10:04:32 +03:00
parent 4108de5931
commit 4059446a3c

View File

@ -14,9 +14,10 @@ def transfer_establishment():
result = [] result = []
# todo: filter(location__city__name__icontains='paris') # todo: filter(location__city__name__icontains='paris')
old_establishments = Establishments.objects.filter(location__city__country_code_2='fr').exclude( old_establishments = Establishments.objects.exclude(
Q(type='Wineyard') | Q(type='Wineyard') |
Q(location__timezone__isnull=True) Q(location__timezone__isnull=True),
id__in=Establishment.objects.all().values_list('old_id', flat=True)
).prefetch_related( ).prefetch_related(
'establishmentinfos_set', 'establishmentinfos_set',
'schedules_set', 'schedules_set',