Когда я экспортирую сообщения из django, я получаю <объект django_quill.fields.FieldQuill по адресу 0x7f0746389840>? ⇐ Python

Программы на Python
Anonymous
Когда я экспортирую сообщения из django, я получаю <объект django_quill.fields.FieldQuill по адресу 0x7f0746389840>?

Сообщение Anonymous »

Я работаю над блогом Django и хочу экспортировать сообщения, и у меня это получилось, но у меня возникла проблема при экспорте текста, потому что я использовал редактор расширенного текста Quill и импорт-экспорт Django

Код: Выделить всё

body = QuillField()
И когда я экспортирую сообщения в Excel, я получаю этот объект .
excel выглядит вот так:
изображение
Это resources.py

Код: Выделить всё

from import_export import resources
from .models import Post

class PostResource(resources.ModelResource):
class Meta:
model = Post
Это view.py

Код: Выделить всё

def export_data(request):
if request.method == 'POST':
# Get selected option from form
file_format = request.POST['file-format']
post_resource = PostResource()
dataset = post_resource.export()
if file_format == 'CSV':
response = HttpResponse(dataset.csv, content_type='text/csv')
response['Content-Disposition'] = 'attachment; filename="exported_data.csv"'
return response
elif file_format == 'JSON':
response = HttpResponse(dataset.json, content_type='application/json')
response['Content-Disposition'] = 'attachment; filename="exported_data.json"'
return response
elif file_format == 'XLS (Excel)':
response = HttpResponse(dataset.xls, content_type='application/vnd.ms-excel')
response['Content-Disposition'] = 'attachment; filename="exported_data.xls"'
return response

return render(request, 'dashboard/export.html')
Есть идеи, как получить текст в этом столбце тела?
Заранее спасибо!

Подробнее здесь: https://stackoverflow.com/questions/751 ... -object-at

Вернуться в «Python»