feat: carwash增加返回记录
This commit is contained in:
parent
bb05ba8c5c
commit
666d317f01
|
@ -163,6 +163,8 @@ class EnvDataExportSerializer(serializers.Serializer):
|
||||||
|
|
||||||
|
|
||||||
class CarWashSerializer(CustomModelSerializer):
|
class CarWashSerializer(CustomModelSerializer):
|
||||||
|
station_name = serializers.CharField(source='station.name', read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CarWash
|
model = CarWash
|
||||||
fields = "__all__"
|
fields = "__all__"
|
||||||
|
|
|
@ -138,6 +138,7 @@ class CarWashViewSet(ListModelMixin, CustomGenericViewSet):
|
||||||
perms_map = {'get': '*'}
|
perms_map = {'get': '*'}
|
||||||
queryset = CarWash.objects.all()
|
queryset = CarWash.objects.all()
|
||||||
serializer_class = CarWashSerializer
|
serializer_class = CarWashSerializer
|
||||||
|
select_related_fields = ['station']
|
||||||
filterset_fields = {
|
filterset_fields = {
|
||||||
"station": ['exact'],
|
"station": ['exact'],
|
||||||
"start_time": ['exact', 'gte', 'lte', 'year', 'month', 'day'],
|
"start_time": ['exact', 'gte', 'lte', 'year', 'month', 'day'],
|
||||||
|
|
Loading…
Reference in New Issue