Merge branch 'development'
[django-tables2.git] / README.rst
1 ================================================
2 django-tables2 - An app for creating HTML tables
3 ================================================
4
5 .. note::
6
7     Prior to v0.6.0 this package was a fork of miracle2k's and both were known
8     as *django-tables*. This caused some problems (e.g. ambiguity and inability
9     to put this library on PyPI) so as of v0.6.0 this package is known as
10     *django-tables2*.
11
12 django-tables2 simplifies the task of turning sets of data into HTML tables. It
13 has native support for pagination and sorting. It does for HTML tables what
14 ``django.forms`` does for HTML forms.
15
16 Creating a table is as simple as::
17
18     import django_tables2 as tables
19
20     class SimpleTable(tables.Table):
21         class Meta:
22             model = Simple
23
24 This would then be used in a view::
25
26     def simple_list(request):
27         queryset = Simple.objects.all()
28         table = SimpleTable(queryset)
29         return render_to_response("simple_list.html", {"table": table},
30                                   context_instance=RequestContext(request))
31
32 And finally in the template::
33
34     {% load django_tables2 %}
35     {% render_table table %}
36
37
38 This example shows one of the simplest cases, but django-tables2 can do a lot
39 more! Check out the `documentation`__ for more details.
40
41 .. __: http://django-tables2.readthedocs.org/en/latest/
42
43
44 Building the documentation
45 ==========================
46
47 If you want to build the docs from within a virtualenv, use::
48
49     make html SPHINXBUILD="python $(which sphinx-build)"