Skip to content

Commit e4bf9fd

Browse files
committed
format the document@
1 parent eca6c23 commit e4bf9fd

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Fonts, colors and charts are not supported.
6161

6262
Installation
6363
============
64-
You can install it from github only for now:
64+
You can install it from github only for now::
6565

6666
$ git clone http://github.com/chfw/django-pyexcel.git
6767
$ cd django-excel
@@ -103,8 +103,8 @@ Here is the example viewing function codes::
103103
else:
104104
form = UploadFileForm()
105105
return render_to_response('upload_form.html',
106-
{'form': form},
107-
context_instance=RequestContext(request))
106+
{'form': form},
107+
context_instance=RequestContext(request))
108108
109109
def download(request):
110110
sheet = excel.pe.Sheet([[1, 2],[3, 4]])

doc/source/index.rst

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
Welcome to django-excel's documentation!
77
========================================
88

9+
:Author: C.W.
10+
:Source code: http://github.com/chfw/django-excel
11+
:Issues: http://github.com/chfw/django-excel/issues
12+
:License: GPL v3 or BSD
13+
:Version: |version|
14+
:Generated: |today|
15+
916
**django-excel** is based on `pyexcel <https://github.com/chfw/pyexcel>`_ and makes it easy to consume/produce information stored in excel files over HTTP protocol as well as on file system. This library can turn the excel data into Pythonic a list of lists, a list of records(dictionaries), dictionaries of lists. And vice versa. Hence it lets you focus on data in Flask based web development, instead of file formats.
1017

1118
The highlighted features are:
@@ -35,7 +42,27 @@ The highlighted features are:
3542
.. _ods3: https://github.com/chfw/pyexcel-ods3
3643
.. _text: https://github.com/chfw/pyexcel-text
3744

38-
This library make infomation processing involving various excel files as easy as processing array, dictionary when processing file upload/download, data import into and export from SQL databases, information analysis and persistence. It uses **pyexcel** and its plugins: 1) to provide one uniform programming interface to handle csv, tsv, xls, xlsx, xlsm and ods formats. 2) to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download 3) 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.
45+
This library makes infomation processing involving various excel files as easy as processing array, dictionary when processing file upload/download, data import into and export from SQL databases, information analysis and persistence. It uses **pyexcel** and its plugins: 1) to provide one uniform programming interface to handle csv, tsv, xls, xlsx, xlsm and ods formats. 2) to provide one-stop utility to import the data in uploaded file into a database and to export tables in a database as excel files for file download 3) 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.
46+
47+
48+
Installation
49+
--------------
50+
You can install it from github only for now::
51+
52+
$ git clone http://github.com/chfw/django-pyexcel.git
53+
$ cd django-excel
54+
$ python setup.py install
55+
56+
Installation of individual plugins , please refer to individual plugin page.
57+
58+
Setup
59+
---------
60+
61+
You will need to update your *settings.py*::
62+
63+
FILE_UPLOAD_HANDLERS = ("django_excel.ExcelMemoryFileUploadHandler",
64+
"django_excel.TemporaryExcelFileUploadHandler")
65+
3966

4067
Tutorial
4168
--------------
@@ -44,7 +71,7 @@ In order to dive in django-excel and get hands-on experience quickly, the test a
4471

4572
git clone https://github.com/chfw/django-excel.git
4673

47-
The test application is written according to Step 1, Step 2 and Step3 of django tutorial version 1.7.1. If you should wonder how the test application was written, please visit django documentation and come back.
74+
The test application is written according to `Part 1 <https://docs.djangoproject.com/en/1.7/intro/tutorial01/>`_, `Part 2 <https://docs.djangoproject.com/en/1.7/intro/tutorial02/>`_ and `Part 3 <https://docs.djangoproject.com/en/1.7/intro/tutorial03/>`_ of django tutorial version 1.7.1. If you should wonder how the test application was written, please visit django documentation and come back.
4875

4976
Once you have the code, please change to django-excel directory and then install all dependencies::
5077

@@ -75,7 +102,7 @@ Choose an excel sheet, for example an xls file, and press "Submit". You will get
75102

76103
.. image :: download-file.png
77104
78-
Please open the file **polls/views.py** and focus on the following code section::
105+
Please open the file `polls/views.py <https://github.com/chfw/django-excel/blob/master/polls/views.py#L27>`_ and focus on the following code section::
79106

80107
class UploadFileForm(forms.Form):
81108
file = forms.FileField()
@@ -100,7 +127,7 @@ Please feel free to change those functions according to :ref:`the mapping table
100127
Handle data import
101128
++++++++++++++++++++++++++++++
102129

103-
This example shows how to import uploaded excel file into django models. We are going to import *sample-data.xls*
130+
This example shows how to import uploaded excel file into django models. We are going to import `sample-data.xls <https://github.com/chfw/django-excel/blob/master/sample-data.xls>`_
104131

105132
.. table:: Sheet 1 of sample-data.xls
106133

@@ -145,7 +172,7 @@ Please visit this link http://localhost:8000/import/, you shall see this upload
145172

146173
.. image:: import-page.png
147174

148-
Please then select *sample-data.xls* and upload. Then visit the admin page http://localhost:8000/admin/polls/question, you shall see questions have been populated:
175+
Please then select `sample-data.xls <https://github.com/chfw/django-excel/blob/master/sample-data.xls>`_ and upload. Then visit the admin page http://localhost:8000/admin/polls/question, you shall see questions have been populated:
149176

150177
.. image:: question-admin.png
151178

@@ -158,7 +185,7 @@ And choices too:
158185

159186
You may use admin interface to delete all those objects and try again.
160187

161-
Now please open views.py and focus on this part of code::
188+
Now please open `polls/views.py <https://github.com/chfw/django-excel/blob/master/polls/views.py#L54>`_ and focus on this part of code::
162189

163190
def import_data(request):
164191
if request.method == "POST":
@@ -213,7 +240,7 @@ Please save and open it. You shall see these data in your window:
213240
.. image:: question-sheet.png
214241
.. image:: choice-sheet.png
215242

216-
Now let's examine the code behind this::
243+
Now let's examine the code behind this in `polls/views.py <https://github.com/chfw/django-excel/blob/master/polls/views.py#L48>`_::
217244

218245
def export_data(request, atype):
219246
if atype == "sheet":

0 commit comments

Comments
 (0)