@@ -59,19 +59,6 @@ and export from SQL databases, information analysis and persistence. It uses
5959#. to provide the same interface for information persistence at server side: saving a uploaded excel file to and loading a saved excel file from file system.
6060
6161
62- Tested Django Versions
63- ========================
64-
65- .. image :: https://img.shields.io/badge/django-1.9-green.svg
66- :target: http://travis-ci.org/chfw/django-excel
67-
68- .. image :: https://img.shields.io/badge/django-1.8.2-green.svg
69- :target: http://travis-ci.org/chfw/django-excel
70-
71- .. image :: https://img.shields.io/badge/django-1.7.8-green.svg
72- :target: http://travis-ci.org/chfw/django-excel
73-
74-
7562Installation
7663--------------
7764You can install it via pip::
@@ -354,121 +341,127 @@ API Reference
354341
355342**django-excel ** attaches **pyexcel ** functions to **InMemoryUploadedFile ** and **TemporaryUploadedFile **.
356343
357- .. module :: django_excel
358-
359- .. autoclass :: ExcelMixin
360-
361- .. method :: get_sheet(sheet_name=None, **keywords)
344+ .. method :: get_sheet(sheet_name=None, **keywords)
362345
363- :param sheet_name: For an excel book, there could be multiple sheets. If it is left
364- unspecified, the sheet at index 0 is loaded. For 'csv', 'tsv' file,
365- *sheet_name * should be None anyway.
366- :param keywords: additional keywords to :meth: `pyexcel.get_sheet `
367- :returns: A sheet object
346+ :param sheet_name: For an excel book, there could be multiple sheets. If it is left
347+ unspecified, the sheet at index 0 is loaded. For 'csv', 'tsv' file,
348+ *sheet_name * should be None anyway.
349+ :param keywords: additional keywords to :meth: `pyexcel.get_sheet `
350+ :returns: A sheet object
368351
369- .. method :: get_array(sheet_name=None, **keywords)
352+ .. method :: get_array(sheet_name=None, **keywords)
370353
371- :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
372- :param keywords: additional keywords to pyexcel library
373- :returns: a two dimensional array, a list of lists
354+ :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
355+ :param keywords: additional keywords to pyexcel library
356+ :returns: a two dimensional array, a list of lists
374357
375- .. method :: get_dict(sheet_name=None, name_columns_by_row=0, **keywords)
358+ .. method :: get_dict(sheet_name=None, name_columns_by_row=0, **keywords)
376359
377- :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
378- :param name_columns_by_row: uses the first row of the sheet to be column headers by default.
379- :param keywords: additional keywords to pyexcel library
380- :returns: a dictionary of the file content
360+ :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
361+ :param name_columns_by_row: uses the first row of the sheet to be column headers by default.
362+ :param keywords: additional keywords to pyexcel library
363+ :returns: a dictionary of the file content
381364
382- .. method :: get_records(sheet_name=None, name_columns_by_row=0, **keywords)
365+ .. method :: get_records(sheet_name=None, name_columns_by_row=0, **keywords)
383366
384- :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
385- :param name_columns_by_row: uses the first row of the sheet to be record field names by default.
386- :param keywords: additional keywords to pyexcel library
387- :returns: a list of dictionary of the file content
367+ :param sheet_name: same as :meth: `~django_excel.ExcelMixin.get_sheet `
368+ :param name_columns_by_row: uses the first row of the sheet to be record field names by default.
369+ :param keywords: additional keywords to pyexcel library
370+ :returns: a list of dictionary of the file content
388371
389- .. method :: get_book(**keywords)
372+ .. method :: get_book(**keywords)
390373
391- :param keywords: additional keywords to pyexcel library
392- :returns: a two dimensional array, a list of lists
374+ :param keywords: additional keywords to pyexcel library
375+ :returns: a two dimensional array, a list of lists
393376
394- .. method :: get_book_dict(**keywords)
377+ .. method :: get_book_dict(**keywords)
395378
396- :param keywords: additional keywords to pyexcel library
397- :returns: a two dimensional array, a list of lists
379+ :param keywords: additional keywords to pyexcel library
380+ :returns: a two dimensional array, a list of lists
398381
399- .. method :: save_to_database(model=None, initializer=None, mapdict=None, **keywords)
382+ .. method :: save_to_database(model=None, initializer=None, mapdict=None, **keywords)
400383
401- :param model: a django model
402- :param initializer: a custom table initialization function if you have one
403- :param mapdict: the explicit table column names if your excel data do not have the exact column names
404- :param keywords: additional keywords to :meth: `pyexcel.Sheet.save_to_django_model `
384+ :param model: a django model
385+ :param initializer: a custom table initialization function if you have one
386+ :param mapdict: the explicit table column names if your excel data do not have the exact column names
387+ :param keywords: additional keywords to :meth: `pyexcel.Sheet.save_to_django_model `
405388
406- .. method :: save_book_to_database(models=None, initializers=None, mapdicts=None, **keywords)
389+ .. method :: save_book_to_database(models=None, initializers=None, mapdicts=None, **keywords)
407390
408- :param models: a list of django models
409- :param initializers: a list of model initialization functions.
410- :param mapdicts: a list of explicit table column names if your excel data sheets do not have the exact column names
411- :param keywords: additional keywords to :meth: `pyexcel.Book.save_to_django_models `
391+ :param models: a list of django models
392+ :param initializers: a list of model initialization functions.
393+ :param mapdicts: a list of explicit table column names if your excel data sheets do not have the exact column names
394+ :param keywords: additional keywords to :meth: `pyexcel.Book.save_to_django_models `
412395
413396Response methods
414397-----------------
415398
416- .. automodule :: django_excel
417-
418- .. method :: make_response(pyexcel_instance, file_type, status=200)
419-
420- :param pyexcel_instance: :class: `pyexcel.Sheet ` or :class: `pyexcel.Book `
421- :param file_type: one of the following strings:
422-
423- * 'csv'
424- * 'tsv'
425- * 'csvz'
426- * 'tsvz'
427- * 'xls'
428- * 'xlsx'
429- * 'xlsm'
430- * 'ods'
431-
432- :param status: unless a different status is to be returned.
433-
434- .. method :: make_response_from_array(array, file_type, status=200)
435-
436- :param array: a list of lists
437- :param file_type: same as :meth: `~django_excel.make_response `
438- :param status: same as :meth: `~django_excel.make_response `
439-
440- .. method :: make_response_from_dict(dict, file_type, status=200)
441-
442- :param dict: a dictinary of lists
443- :param file_type: same as :meth: `~django_excel.make_response `
444- :param status: same as :meth: `~django_excel.make_response `
445-
446- .. method :: make_response_from_records(records, file_type, status=200)
447-
448- :param records: a list of dictionaries
449- :param file_type: same as :meth: `~django_excel.make_response `
450- :param status: same as :meth: `~django_excel.make_response `
451-
452-
453- .. method :: make_response_from_book_dict(book_dict, file_type, status=200)
454-
455- :param book_dict: a dictionary of two dimensional arrays
456- :param file_type: same as :meth: `~django_excel.make_response `
457- :param status: same as :meth: `~django_excel.make_response `
458-
459- .. autofunction :: make_response_from_a_table(model, file_type status=200)
460-
461-
462- .. method :: make_response_from_query_sets(query_sets, column_names, file_type status=200)
463-
464- Produce a single sheet Excel book of *file_type * from your custom database queries
465-
466- :param query_sets: a query set
467- :param column_names: a nominated column names. It could not be None, otherwise no data is returned.
468- :param file_type: same as :meth: `~django_excel.make_response `
469- :param status: same as :meth: `~django_excel.make_response `
470-
471- .. autofunction :: make_response_from_tables(models, file_type status=200)
399+ .. method :: make_response(pyexcel_instance, file_type, status=200)
400+
401+ :param pyexcel_instance: :class: `pyexcel.Sheet ` or :class: `pyexcel.Book `
402+ :param file_type: one of the following strings:
403+
404+ * 'csv'
405+ * 'tsv'
406+ * 'csvz'
407+ * 'tsvz'
408+ * 'xls'
409+ * 'xlsx'
410+ * 'xlsm'
411+ * 'ods'
412+
413+ :param status: unless a different status is to be returned.
414+
415+ .. method :: make_response_from_array(array, file_type, status=200)
416+
417+ :param array: a list of lists
418+ :param file_type: same as :meth: `~django_excel.make_response `
419+ :param status: same as :meth: `~django_excel.make_response `
420+
421+ .. method :: make_response_from_dict(dict, file_type, status=200)
422+
423+ :param dict: a dictinary of lists
424+ :param file_type: same as :meth: `~django_excel.make_response `
425+ :param status: same as :meth: `~django_excel.make_response `
426+
427+ .. method :: make_response_from_records(records, file_type, status=200)
428+
429+ :param records: a list of dictionaries
430+ :param file_type: same as :meth: `~django_excel.make_response `
431+ :param status: same as :meth: `~django_excel.make_response `
432+
433+
434+ .. method :: make_response_from_book_dict(book_dict, file_type, status=200)
435+
436+ :param book_dict: a dictionary of two dimensional arrays
437+ :param file_type: same as :meth: `~django_excel.make_response `
438+ :param status: same as :meth: `~django_excel.make_response `
439+
440+ .. method :: make_response_from_a_table(model, file_type status=200)
441+ Produce a single sheet Excel book of *file_type *
442+
443+ :param model: a Django model
444+ :param file_type: same as :meth: `~django_excel.make_response `
445+ :param status: same as :meth: `~django_excel.make_response `
446+
447+ .. method :: make_response_from_query_sets(query_sets, column_names, file_type status=200)
448+
449+ Produce a single sheet Excel book of *file_type * from your custom database queries
450+
451+ :param query_sets: a query set
452+ :param column_names: a nominated column names. It could not be None, otherwise no data is returned.
453+ :param file_type: same as :meth: `~django_excel.make_response `
454+ :param status: same as :meth: `~django_excel.make_response `
455+
456+ .. method :: make_response_from_tables(models, file_type status=200)
457+
458+ Produce a multiple sheet Excel book of *file_type *. It becomes the same
459+ as :meth: `~django_excel.make_response_from_a_table ` if you pass *tables *
460+ with an array that has a single table
461+
462+ :param models: a list of Django models
463+ :param file_type: same as :meth: `~django_excel.make_response `
464+ :param status: same as :meth: `~django_excel.make_response `
472465
473466Indices and tables
474467--------------------
0 commit comments