本文整理匯總了Python中models.Document.date_time方法的典型用法代碼示例。如果您正苦於以下問題:Python Document.date_time方法的具體用法?Python Document.date_time怎麽用?Python Document.date_time使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Document
的用法示例。
在下文中一共展示了Document.date_time方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: post
# 需要導入模塊: from models import Document [as 別名]
# 或者: from models.Document import date_time [as 別名]
def post(self, request, format=None):
my_file = request.FILES['file']
file_name = str(uuid.uuid1())+'.dcm'
print(file_name)
with open(file_name, 'wb+') as temp_file:
temp_file.write(my_file.read())
print(file_name)
ds = dicom.read_file(file_name)
document = Document()
document.date_time = datetime.datetime.now()
document.doc_file = request.FILES['file']
document.save()
print(document.doc_id)
for ke in ds.dir():
if ke == 'PixelData':
continue
prop = DICOMProperty()
prop.prop_key = ke;
prop.prop_value = str(getattr(ds, ke, ''))
prop.doc_id = document
print(prop)
prop.save()
print(Document.objects.all())
documents = Document.objects.all()
serializer = DocumentListSerializer(documents)
print(serializer.data)
#return Response(status=status.HTTP_200_OK, data=serializer.data)
return HttpResponseRedirect("/static/header.html")