subtypes to establishments list
This commit is contained in:
parent
5687eff646
commit
e633b4f5f5
|
|
@ -128,7 +128,7 @@ class EstablishmentQuerySet(models.QuerySet):
|
|||
def with_base_related(self):
|
||||
"""Return qs with related objects."""
|
||||
return self.select_related('address', 'establishment_type'). \
|
||||
prefetch_related('tags', 'tags__translation').with_main_image()
|
||||
prefetch_related('tags', 'tags__translation', 'establishment_subtypes').with_main_image()
|
||||
|
||||
def with_schedule(self):
|
||||
"""Return qs with related schedule."""
|
||||
|
|
|
|||
|
|
@ -83,6 +83,8 @@ class EstablishmentListCreateSerializer(model_serializers.EstablishmentBaseSeria
|
|||
child=serializers.CharField(max_length=128),
|
||||
required=False,
|
||||
)
|
||||
subtypes = model_serializers.EstablishmentSubTypeBaseSerializer(source='establishment_subtypes',
|
||||
read_only=True, many=True)
|
||||
|
||||
class Meta(model_serializers.EstablishmentBaseSerializer.Meta):
|
||||
fields = [
|
||||
|
|
@ -98,6 +100,7 @@ class EstablishmentListCreateSerializer(model_serializers.EstablishmentBaseSeria
|
|||
'toque_number',
|
||||
'type_id',
|
||||
'type',
|
||||
'subtypes',
|
||||
'socials',
|
||||
'image_url',
|
||||
'slug',
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user