File tree 2 files changed +6
-7
lines changed
templates/static/src/controller
2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -211,8 +211,8 @@ export const exportController = (dataTable) => {
211
211
export const exportData = ( dataTable , type ) => {
212
212
213
213
const searchParam = new URLSearchParams ( window . location . search ) . get ( 'search' ) || ''
214
-
215
- const hiddenColumns = myData . headings . filter ( ( d , i ) => ! dataTable . columns . visible ( i ) )
214
+
215
+ const hiddenColumns = myData . headings . filter ( ( d , i ) => ! dataTable . columns ( ) . visible ( i ) )
216
216
217
217
fetch ( `/datatb/${ modelName } /export/` ,
218
218
{ method : 'POST' , body : JSON . stringify ( {
Original file line number Diff line number Diff line change @@ -149,10 +149,9 @@ def export(request, **kwargs):
149
149
export_type = request_body .get ('type' , 'csv' )
150
150
filter_options = Q ()
151
151
152
- headings = filter (lambda field : field .name not in hidden , _get_headings (model_class ))
153
- headings = list (headings )
152
+ headings = list (_get_headings (model_class ))
154
153
for field in headings :
155
- field_name = field . name
154
+ field_name = field
156
155
try :
157
156
filter_options = filter_options | Q (** {field_name + '__icontains' : search_key })
158
157
except Exception as _ :
@@ -163,12 +162,12 @@ def export(request, **kwargs):
163
162
for data in all_data :
164
163
this_row = []
165
164
for heading in headings :
166
- this_row .append (getattr (data , heading . name ))
165
+ this_row .append (getattr (data , heading ))
167
166
table_data .append (this_row )
168
167
169
168
df = pd .DataFrame (
170
169
table_data ,
171
- columns = tuple (heading . name for heading in headings ))
170
+ columns = tuple (heading for heading in headings ))
172
171
if export_type == 'pdf' :
173
172
base64encoded = get_pdf (df )
174
173
elif export_type == 'xlsx' :
You can’t perform that action at this time.
0 commit comments