|
|
|
@ -1,5 +1,6 @@ |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
# -*- coding: utf-8 -*- |
|
|
|
import copy |
|
|
|
import copy |
|
|
|
|
|
|
|
from django.db.models import Q |
|
|
|
from django.conf import settings |
|
|
|
from django.conf import settings |
|
|
|
from functions.translate import fill_with_signal |
|
|
|
from functions.translate import fill_with_signal |
|
|
|
import calendar as python_calendar |
|
|
|
import calendar as python_calendar |
|
|
|
@ -88,6 +89,18 @@ class EventMixin(object): |
|
|
|
|
|
|
|
|
|
|
|
return list(Service.objects.language().filter(url__in=ids).order_by('sort')) |
|
|
|
return list(Service.objects.language().filter(url__in=ids).order_by('sort')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_services_detail(self, exluded, _type): |
|
|
|
|
|
|
|
if not isinstance(getattr(self, '_get_services_detail', None), list): |
|
|
|
|
|
|
|
# excluded = ['visit', 'tickets'] |
|
|
|
|
|
|
|
country_ids = [item for item, bool in self.country.services if bool==True] |
|
|
|
|
|
|
|
ids = [item for item, bool in self.services if bool==True] |
|
|
|
|
|
|
|
qs = Service.objects.language() |
|
|
|
|
|
|
|
if exluded is not None: |
|
|
|
|
|
|
|
qs = qs.exclude(url__in=excluded) |
|
|
|
|
|
|
|
qs = qs.filter(Q(Q(url__in=country_ids) & Q(type=_type)) | Q(url__in=ids)) |
|
|
|
|
|
|
|
self._get_services_detail = list(qs) |
|
|
|
|
|
|
|
return self._get_services_detail |
|
|
|
|
|
|
|
|
|
|
|
def duration_days(self, month=None): |
|
|
|
def duration_days(self, month=None): |
|
|
|
if not month: |
|
|
|
if not month: |
|
|
|
d = self.data_end - self.data_begin |
|
|
|
d = self.data_end - self.data_begin |
|
|
|
@ -177,4 +190,4 @@ class EventMixin(object): |
|
|
|
for item in source.all(): |
|
|
|
for item in source.all(): |
|
|
|
destination.add(item) |
|
|
|
destination.add(item) |
|
|
|
|
|
|
|
|
|
|
|
return duplicate |
|
|
|
return duplicate |
|
|
|
|