fix highlight logic
This commit is contained in:
@@ -103,8 +103,13 @@ class RouteSerializer(serializers.ModelSerializer):
|
||||
transport_types = dict(type_transport_choices)
|
||||
return transport_types.get(obj.type_transport, obj.type_transport)
|
||||
|
||||
def get_is_highlighted(self, obj):
|
||||
return obj.is_currently_highlighted
|
||||
def get_is_highlighted(self, obj):
|
||||
now = timezone.now()
|
||||
|
||||
if obj.highlight_end_DT and obj.is_highlighted:
|
||||
result = now <= obj.highlight_end_DT
|
||||
return result
|
||||
return False
|
||||
|
||||
class CreateRouteSerializer(serializers.ModelSerializer):
|
||||
country_from = serializers.CharField(write_only=True)
|
||||
|
||||
Reference in New Issue
Block a user