|
@@ -49,6 +49,8 @@ class UIDView(View):
|
|
|
return self.do_remove(request_dict, response)
|
|
|
elif operation == 'download':
|
|
|
return self.download_txt(token, response)
|
|
|
+ elif operation == 'download_1':
|
|
|
+ return self.download_txt_two(token, response)
|
|
|
else:
|
|
|
return response.json(309)
|
|
|
|
|
@@ -271,3 +273,25 @@ class UIDView(View):
|
|
|
response['Content-Disposition'] = 'attachment;filename=' + filename
|
|
|
|
|
|
return response
|
|
|
+
|
|
|
+ def download_txt_two(self, token, response):
|
|
|
+
|
|
|
+ uid_qs = UIDModel.objects.filter(status=1)
|
|
|
+
|
|
|
+ if not uid_qs.exists():
|
|
|
+ return response.json(308)
|
|
|
+
|
|
|
+ uid_qs = uid_qs.values()
|
|
|
+ content = ''
|
|
|
+ for item in uid_qs:
|
|
|
+ # print(item)
|
|
|
+ content += item['uid']
|
|
|
+ content += '\r\n'
|
|
|
+
|
|
|
+ content = content[0:len(content) - 1]
|
|
|
+ response = StreamingHttpResponse(content)
|
|
|
+ response['Content-Type'] = 'application/octet-stream'
|
|
|
+ filename = 'uid_need_to_set_up_push.txt'
|
|
|
+ response['Content-Disposition'] = 'attachment;filename=' + filename
|
|
|
+
|
|
|
+ return response
|