feat: carwash增加返回记录

This commit is contained in:
caoqianming 2024-02-27 14:31:35 +08:00
parent bb05ba8c5c
commit 666d317f01
2 changed files with 3 additions and 0 deletions

View File

@ -163,6 +163,8 @@ class EnvDataExportSerializer(serializers.Serializer):
class CarWashSerializer(CustomModelSerializer):
station_name = serializers.CharField(source='station.name', read_only=True)
class Meta:
model = CarWash
fields = "__all__"

View File

@ -138,6 +138,7 @@ class CarWashViewSet(ListModelMixin, CustomGenericViewSet):
perms_map = {'get': '*'}
queryset = CarWash.objects.all()
serializer_class = CarWashSerializer
select_related_fields = ['station']
filterset_fields = {
"station": ['exact'],
"start_time": ['exact', 'gte', 'lte', 'year', 'month', 'day'],