update
This commit is contained in:
parent
2c7b3fffff
commit
b412b7c12a
|
@ -57,9 +57,9 @@ App({
|
||||||
globalData: {
|
globalData: {
|
||||||
userInfo: {},
|
userInfo: {},
|
||||||
userinfo: {}, // 服务器传回的消费者信息
|
userinfo: {}, // 服务器传回的消费者信息
|
||||||
host: 'https://apitest.ahctc.cn',
|
//host: 'https://apitest.ahctc.cn',
|
||||||
mediahost: 'https://apitest.ahctc.cn',
|
mediahost: 'https://apitest.ahctc.cn',
|
||||||
//host: 'http://127.0.0.1:8000',
|
host: 'http://127.0.0.1:8000',
|
||||||
//mediahost: 'http://127.0.0.1:8000',
|
//mediahost: 'http://127.0.0.1:8000',
|
||||||
token : '',
|
token : '',
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"disablePlugins": [],
|
"disablePlugins": [],
|
||||||
"outputPath": ""
|
"outputPath": ""
|
||||||
},
|
},
|
||||||
|
"useIsolateContext": true,
|
||||||
"useCompilerModule": false,
|
"useCompilerModule": false,
|
||||||
"userConfirmedUseCompilerModuleSwitch": false
|
"userConfirmedUseCompilerModuleSwitch": false
|
||||||
},
|
},
|
||||||
|
|
|
@ -140,10 +140,21 @@ class PaperDetailSerializer(serializers.ModelSerializer):
|
||||||
create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||||
update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
update_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", required=False, read_only=True)
|
||||||
workscope_name = serializers.StringRelatedField(source='workscope', read_only=True)
|
workscope_name = serializers.StringRelatedField(source='workscope', read_only=True)
|
||||||
questions = PaperQuestionsDetailSerializer(source='paperquestions_set', many=True, read_only=True)
|
questions = serializers.SerializerMethodField()
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Paper
|
model = Paper
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
|
def get_questions(self, instance):
|
||||||
|
queryset = instance.questions.all().order_by('type')
|
||||||
|
return PaperQuestionsDetailSerializer(queryset, many=True).data
|
||||||
|
|
||||||
|
# @staticmethod
|
||||||
|
# def setup_eager_loading(queryset):
|
||||||
|
# """ Perform necessary eager loading of data. """
|
||||||
|
# queryset = queryset.prefetch_related(
|
||||||
|
# 'questions',)
|
||||||
|
# return queryset
|
||||||
|
|
||||||
class PaperQuestionsCreateSerializer(serializers.ModelSerializer):
|
class PaperQuestionsCreateSerializer(serializers.ModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -317,7 +317,7 @@ class PaperViewSet(ModelViewSet):
|
||||||
ordering = ['id']
|
ordering = ['id']
|
||||||
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
filter_backends = [DjangoFilterBackend, SearchFilter, OrderingFilter]
|
||||||
filterset_fields = ['workscope']
|
filterset_fields = ['workscope']
|
||||||
search_fields = ('^name',)
|
search_fields = ('name',)
|
||||||
|
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self):
|
||||||
if self.action=='list':
|
if self.action=='list':
|
||||||
|
|
Loading…
Reference in New Issue