File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed
templates/static/src/controller Expand file tree Collapse file tree 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) => {
211211export const exportData = ( dataTable , type ) => {
212212
213213 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 ) )
216216
217217 fetch ( `/datatb/${ modelName } /export/` ,
218218 { method : 'POST' , body : JSON . stringify ( {
Original file line number Diff line number Diff line change @@ -149,10 +149,9 @@ def export(request, **kwargs):
149149 export_type = request_body .get ('type' , 'csv' )
150150 filter_options = Q ()
151151
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 ))
154153 for field in headings :
155- field_name = field . name
154+ field_name = field
156155 try :
157156 filter_options = filter_options | Q (** {field_name + '__icontains' : search_key })
158157 except Exception as _ :
@@ -163,12 +162,12 @@ def export(request, **kwargs):
163162 for data in all_data :
164163 this_row = []
165164 for heading in headings :
166- this_row .append (getattr (data , heading . name ))
165+ this_row .append (getattr (data , heading ))
167166 table_data .append (this_row )
168167
169168 df = pd .DataFrame (
170169 table_data ,
171- columns = tuple (heading . name for heading in headings ))
170+ columns = tuple (heading for heading in headings ))
172171 if export_type == 'pdf' :
173172 base64encoded = get_pdf (df )
174173 elif export_type == 'xlsx' :
You can’t perform that action at this time.
0 commit comments