added new fields
This commit is contained in:
parent
084db83c92
commit
990b15f1d7
|
|
@ -553,6 +553,10 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
||||||
PUBLISHED = 2
|
PUBLISHED = 2
|
||||||
UNPICKED = 3
|
UNPICKED = 3
|
||||||
WAITING = 4
|
WAITING = 4
|
||||||
|
HIDDEN = 5
|
||||||
|
DELETED = 6
|
||||||
|
OUT_OF_SELECTION = 7
|
||||||
|
UNPUBLISHED = 8
|
||||||
|
|
||||||
STATUS_CHOICES = (
|
STATUS_CHOICES = (
|
||||||
(ABANDONED, _('Abandoned')),
|
(ABANDONED, _('Abandoned')),
|
||||||
|
|
@ -560,6 +564,10 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
||||||
(PUBLISHED, _('Published')),
|
(PUBLISHED, _('Published')),
|
||||||
(UNPICKED, _('Unpicked')),
|
(UNPICKED, _('Unpicked')),
|
||||||
(WAITING, _('Waiting')),
|
(WAITING, _('Waiting')),
|
||||||
|
(HIDDEN, _('Hidden')),
|
||||||
|
(DELETED, _('Deleted')),
|
||||||
|
(OUT_OF_SELECTION, _('Out of selection')),
|
||||||
|
(UNPUBLISHED, _('Unpublished')),
|
||||||
)
|
)
|
||||||
|
|
||||||
old_id = models.PositiveIntegerField(_('old id'), blank=True, null=True, default=None)
|
old_id = models.PositiveIntegerField(_('old id'), blank=True, null=True, default=None)
|
||||||
|
|
@ -844,6 +852,10 @@ class Establishment(GalleryMixin, ProjectBaseMixin, URLImageMixin,
|
||||||
def distillery_type_indexing(self):
|
def distillery_type_indexing(self):
|
||||||
return self.tags.filter(category__index_name='distillery_type')
|
return self.tags.filter(category__index_name='distillery_type')
|
||||||
|
|
||||||
|
@property
|
||||||
|
def food_producer_indexing(self):
|
||||||
|
return self.tags.filter(category__index_name='producer_type')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def last_comment(self):
|
def last_comment(self):
|
||||||
if hasattr(self, 'comments_prefetched') and len(self.comments_prefetched):
|
if hasattr(self, 'comments_prefetched') and len(self.comments_prefetched):
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ from location.serializers import (
|
||||||
EstablishmentWineRegionBaseSerializer,
|
EstablishmentWineRegionBaseSerializer,
|
||||||
)
|
)
|
||||||
from main.serializers import AwardSerializer, CurrencySerializer
|
from main.serializers import AwardSerializer, CurrencySerializer
|
||||||
from review.serializers import ReviewShortSerializer
|
from review.serializers import ReviewShortSerializer, ReviewBaseSerializer
|
||||||
from tag.serializers import TagBaseSerializer
|
from tag.serializers import TagBaseSerializer
|
||||||
from timetable.serialziers import ScheduleRUDSerializer
|
from timetable.serialziers import ScheduleRUDSerializer
|
||||||
from utils import exceptions as utils_exceptions
|
from utils import exceptions as utils_exceptions
|
||||||
|
|
@ -408,6 +408,8 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
||||||
restaurant_cuisine = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
restaurant_cuisine = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
artisan_category = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
distillery_type = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
distillery_type = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
|
food_producer = TagBaseSerializer(read_only=True, many=True, allow_null=True)
|
||||||
|
reviews = ReviewBaseSerializer(read_only=True, many=True)
|
||||||
|
|
||||||
class Meta(EstablishmentBaseSerializer.Meta):
|
class Meta(EstablishmentBaseSerializer.Meta):
|
||||||
"""Meta class."""
|
"""Meta class."""
|
||||||
|
|
@ -418,6 +420,10 @@ class EstablishmentListRetrieveSerializer(EstablishmentBaseSerializer):
|
||||||
'restaurant_cuisine',
|
'restaurant_cuisine',
|
||||||
'artisan_category',
|
'artisan_category',
|
||||||
'distillery_type',
|
'distillery_type',
|
||||||
|
'food_producer',
|
||||||
|
'vintage_year',
|
||||||
|
'reviews',
|
||||||
|
'contact_phones',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,8 @@ class EstablishmentListView(EstablishmentMixinView, generics.ListAPIView):
|
||||||
.with_certain_tag_category_related('category', 'restaurant_category') \
|
.with_certain_tag_category_related('category', 'restaurant_category') \
|
||||||
.with_certain_tag_category_related('cuisine', 'restaurant_cuisine') \
|
.with_certain_tag_category_related('cuisine', 'restaurant_cuisine') \
|
||||||
.with_certain_tag_category_related('shop_category', 'artisan_category') \
|
.with_certain_tag_category_related('shop_category', 'artisan_category') \
|
||||||
.with_certain_tag_category_related('distillery_type', 'distillery_type')
|
.with_certain_tag_category_related('distillery_type', 'distillery_type') \
|
||||||
|
.with_certain_tag_category_related('food_producer', 'producer_type')
|
||||||
|
|
||||||
|
|
||||||
class EstablishmentSimilarView(EstablishmentListView):
|
class EstablishmentSimilarView(EstablishmentListView):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user