Questions tagged [django-tables2]

django-tables2 simplifies the task of turning sets of data into HTML tables.

Native support for pagination and sorting. It does for HTML tables what django.forms does for HTML forms.

  • Any iterable can be a data-source, but special support for Django querysets is included.
  • The builtin UI does not rely on JavaScript.
  • Support for automatic table generation based on a Django model.
  • Supports custom column functionality via subclassing.
  • Pagination.
  • Column based table sorting.
  • Template tag to enable trivial rendering to HTML.
  • Generic view mixin.

Related links:

628 questions
8
votes
3 answers

django tables2 create extra column with links

I am trying to add a extra column to one of my tables, that adds url to another page. My Table: class ItemTable(tables.Table): edit = tables.LinkColumn('item_edit', args=[A('pk')]) class Meta: model = Item fields = ('name',…
Hans de Jong
  • 2,030
  • 6
  • 35
  • 55
8
votes
2 answers

Trouble trying to dynamically add methods to Python class (i.e. django-tables2 'Table')

So for a Django project, I would really like to be able to generate and display tables (not based on querysets) dynamically without needing to know the contents or schema beforehand. It looks like the django-tables2 app provides nice functionality…
rogueleaderr
  • 4,671
  • 2
  • 33
  • 40
8
votes
2 answers

select all rows in django_tables2

I have tried to select all rows in a table by clicking on the upper check box in a CheckBoxColumn with the following definition: selection = tables.CheckBoxColumn(accessor="pk", orderable=False) However the rows are not selected, is there anything…
gypaetus
  • 6,873
  • 3
  • 35
  • 45
8
votes
1 answer

How to get information from Django_tables2 row?

I have declared a table and want to fetch the row's value which is checked using checkboxfield. Any help, how can i write this event in my views so that everytime I select a row and hit submit button, it returns the row's values.Code goes like…
Karan
  • 239
  • 4
  • 13
7
votes
1 answer

The linkcolumn about django-tables2

I use django-tables2 to show some data in page,and now I want to make the cell link to some url,but the link url such as : url(r'^(?P\w+)/(?P\d+)/$', 'pool.views.pooldatestock', name="pool_date_stock"), and I read the documents of…
sword
  • 225
  • 2
  • 5
  • 9
7
votes
2 answers

display data in tables in django

I have narrowed down to the following , if anyone can help me pointing out how i can convert the following into table view that would be awesome. Following html is extended from the base.html {% block page_content %}

Projects

red barret
  • 91
  • 1
  • 1
  • 7
7
votes
1 answer

django-tables2 doesn't sort

can't get sorting working for a django-tables2 table. class MyModel(models.Model): pid = models.AutoField('id',primary_key = True) name = models.CharField(max_length = 255, help_text='The name') def…
giZm0
  • 1,481
  • 21
  • 37
6
votes
1 answer

In django-tables2, make number of rows displayed depend on screen size?

When using django-tables2, use the paginate parameter to limit the number of rows displayed. For instance, if I have the table my_table, then in views.py I set it to display 10 rows as follows: RequestConfig(request,…
eric
  • 7,142
  • 12
  • 72
  • 138
6
votes
2 answers

dynamically set per_page in django-tables2

Websites often allow the user to specify how many items to show per page in a paginated table. Iwould like to do this with django-tables2. I could add a "Show [ 5 | 10 | 50 ] per page" select box to collect a per_page parameter from the…
Ivan Uemlianin
  • 953
  • 7
  • 21
6
votes
7 answers

How to add counter column in django-tables2?

I'm trying to add a counter on the first column of a table using django-tables2, but the solution below is only showing all 0 under the # column. How should I add a column that will have a column that numbers the rows? tables.py: import…
bayman
  • 1,579
  • 5
  • 23
  • 46
6
votes
2 answers

How do I filter tables with Django generic views?

I am trying to create a table view with pagination, sorting, and filtering, using the most common/standard/recommended approach for Django 1.6. This seems to be Generic Class-Based Views and django-tables2. I've found at least two different…
6
votes
1 answer

Django: django-tables2 pagination and filtering

I have a working table generated by django-tables2: my_filter = TestFilter(request.POST) table = TestTable(TestObj.objects.all(), order_by="-my_date") RequestConfig(request, paginate={"per_page": 10}).configure(table) return render(request,…
Dirty Penguin
  • 4,212
  • 9
  • 45
  • 69
6
votes
1 answer

django-tables2 with custom image cell

in a simple django-tables2 how can i render an imagen in specific cell for 1 colum.... some like field1 field2 field3 . . . row1 A image1 C row2 B image2 D . . .
emper0r
  • 63
  • 1
  • 3
6
votes
2 answers

Is it possible to apply a template tag to a when using django-tables2?

I am using django-tables2 to create my table for me. I need to apply a template tag to each of the cells () in one of the columns. It seems like alot of extra effort to go through and create a custom table layout just to apply the template tag to…
cjohnston
  • 135
  • 6
5
votes
2 answers

django-tables2 linkcolumn multiple items in the same cell

I'd like to add multiple 'items' to the same cell using tables.LinkColumn. Something like this: column_name = tables.LinkColumn('some_url_edit', args=[A('pk')], attrs={'class':'tbl_icon edit'}) column_name += tables.LinkColumn('some_url_del',…
Mission
  • 1,287
  • 3
  • 16
  • 31
1
2
3
41 42