You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At your first attempt, a instance of polls.models.Question was obtained at line 180 and at the second one, line 180 would not get "question__question_text" from Choice.
There is a way definitely. One thought I had is to check if the value is a field or a foreign key to another model. If the value is the latter case, maybe put a str() around it to get its representation. The ideal case would be to support 'question__question_text' at L180. let me have a look.
while that code works fine, but it failed when I tried to include question it self
def export_data(request, atype):
....
elif atype == "custom":
question = Question.objects.get(slug='ide')
query_sets = Choice.objects.filter(question=question)
column_names = ['question','choice_text', 'votes']
sheet = excel.pe.get_sheet(query_sets=query_sets, column_names=column_names)
sheet.row[0] = ["Question", "Choice", "Votes"] # please put verbose_name list here
return excel.make_response(sheet, 'xls')
would return me
Unexpected data type
but if I were to replace column_names to
`
column_names = ['question__question_text','choice_text', 'votes']
`
it would returns me :
'Choice' object has no attribute 'question__question_text'
is there anyway to do this?
thanks!
The text was updated successfully, but these errors were encountered: