update transfer tz field

This commit is contained in:
evgeniy-st 2019-10-31 17:34:59 +03:00
parent 30a58473c3
commit b87f21c630
3 changed files with 10 additions and 11 deletions

View File

@ -37,7 +37,7 @@ class EstablishmentDocument(Document):
works_noon = fields.ListField(fields.IntegerField( works_noon = fields.ListField(fields.IntegerField(
attr='works_noon' attr='works_noon'
)) ))
# works_now = fields.BooleanField(attr='works_now') works_now = fields.BooleanField(attr='works_now')
tags = fields.ObjectField( tags = fields.ObjectField(
properties={ properties={
'id': fields.IntegerField(attr='id'), 'id': fields.IntegerField(attr='id'),

View File

@ -139,7 +139,7 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
'lookups': [ 'lookups': [
constants.LOOKUP_QUERY_IN, constants.LOOKUP_QUERY_IN,
], ],
}, },
'works_noon': { 'works_noon': {
'field': 'works_noon', 'field': 'works_noon',
'lookups': [ 'lookups': [
@ -152,12 +152,12 @@ class EstablishmentDocumentViewSet(BaseDocumentViewSet):
constants.LOOKUP_QUERY_IN, constants.LOOKUP_QUERY_IN,
], ],
}, },
# 'works_now': { 'works_now': {
# 'field': 'works_now', 'field': 'works_now',
# 'lookups': [ 'lookups': [
# constants.LOOKUP_FILTER_TERM, constants.LOOKUP_FILTER_TERM,
# ] ]
# }, },
} }
geo_spatial_filter_fields = { geo_spatial_filter_fields = {

View File

@ -6,8 +6,8 @@ from establishment.models import Establishment, ContactEmail, ContactPhone, Esta
from location.models import Address from location.models import Address
from timetable.models import Timetable from timetable.models import Timetable
from utils.legacy_parser import parse_legacy_schedule_content from utils.legacy_parser import parse_legacy_schedule_content
from utils.serializers import TimeZoneChoiceField
from utils.slug_generator import generate_unique_slug from utils.slug_generator import generate_unique_slug
from pytz import timezone as ptz
class EstablishmentSerializer(serializers.ModelSerializer): class EstablishmentSerializer(serializers.ModelSerializer):
@ -26,7 +26,7 @@ class EstablishmentSerializer(serializers.ModelSerializer):
twitter = serializers.CharField(allow_null=True, allow_blank=True) twitter = serializers.CharField(allow_null=True, allow_blank=True)
booking = serializers.CharField(allow_null=True, allow_blank=True) booking = serializers.CharField(allow_null=True, allow_blank=True)
state = serializers.CharField(allow_null=True) state = serializers.CharField(allow_null=True)
tz = serializers.CharField() tz = TimeZoneChoiceField()
created = serializers.DateTimeField(format='%m-%d-%Y %H:%M:%S') created = serializers.DateTimeField(format='%m-%d-%Y %H:%M:%S')
class Meta: class Meta:
@ -59,7 +59,6 @@ class EstablishmentSerializer(serializers.ModelSerializer):
'establishment_type_id': self.get_type(data), 'establishment_type_id': self.get_type(data),
'is_publish': data.get('state') == 'published', 'is_publish': data.get('state') == 'published',
}) })
data['tz'] = ptz(data['tz'])
data.pop('location') data.pop('location')
data.pop('type') data.pop('type')
data.pop('state') data.pop('state')