fixed carousel
This commit is contained in:
parent
15ef2295ca
commit
8ac5a1970f
|
|
@ -1,6 +1,7 @@
|
|||
"""Establishment models."""
|
||||
from functools import reduce
|
||||
|
||||
import elasticsearch_dsl
|
||||
from django.conf import settings
|
||||
from django.contrib.contenttypes import fields as generic
|
||||
from django.contrib.gis.db.models.functions import Distance
|
||||
|
|
@ -11,12 +12,11 @@ from django.db import models
|
|||
from django.db.models import When, Case, F, ExpressionWrapper, Subquery, Q
|
||||
from django.utils import timezone
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from elasticsearch_dsl import Q
|
||||
from phonenumber_field.modelfields import PhoneNumberField
|
||||
|
||||
from collection.models import Collection
|
||||
from main.models import Award, MetaDataContent
|
||||
from location.models import Address
|
||||
from main.models import Award, MetaDataContent
|
||||
from review.models import Review
|
||||
from utils.models import (ProjectBaseMixin, TJSONField, URLImageMixin,
|
||||
TranslatedFieldsMixin, BaseAttributes)
|
||||
|
|
@ -103,8 +103,8 @@ class EstablishmentQuerySet(models.QuerySet):
|
|||
"""Search text via ElasticSearch."""
|
||||
from search_indexes.documents import EstablishmentDocument
|
||||
search = EstablishmentDocument.search().filter(
|
||||
Q('match', name=value) |
|
||||
Q('match', **{f'description.{locale}': value})
|
||||
elasticsearch_dsl.Q('match', name=value) |
|
||||
elasticsearch_dsl.Q('match', **{f'description.{locale}': value})
|
||||
).execute()
|
||||
ids = [result.meta.id for result in search]
|
||||
return self.filter(id__in=ids)
|
||||
|
|
@ -375,8 +375,8 @@ class Establishment(ProjectBaseMixin, URLImageMixin, TranslatedFieldsMixin):
|
|||
|
||||
@property
|
||||
def the_most_recent_award(self):
|
||||
return Award.objects.filter(Q(establishment=self) | Q(employees__establishments=self)).latest(
|
||||
field_name='vintage_year')
|
||||
return Award.objects.filter(Q(establishment=self) | Q(employees__establishments=self)) \
|
||||
.latest(field_name='vintage_year')
|
||||
|
||||
|
||||
class Position(BaseAttributes, TranslatedFieldsMixin):
|
||||
|
|
|
|||
|
|
@ -116,6 +116,8 @@ class NewsBaseSerializer(ProjectModelSerializer):
|
|||
'tags',
|
||||
'slug',
|
||||
'gallery',
|
||||
'image_url',
|
||||
'preview_image_url',
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user