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
3
votes
2 answers

How to prevent a row count from being sent to the db when paginator is disabled

I'm using Django 1.11, Django-tables2 1.19.0 with MS SQL via django-pyodbc-azure 1.11.0.0. I'm showing a table for a model that is for a rather slow view which unfortunately must run sub-queries for every row. I can't change the view, and so I've…
fzzylogic
  • 2,183
  • 1
  • 19
  • 25
3
votes
2 answers

Adding CSS style to table in django with django_tables2

I'm very new to Django. I'm trying to add a CSS style to a table when {% render_table table %} is being run. The code looks as following: views.py: def myTable(request): table = myDataTable.objects.all() filter = request.GET.get('q') …
ujawg
  • 221
  • 3
  • 7
3
votes
1 answer

When used django_tables2, it told me TemplateDoesNotExist

urls.py urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', views.people), ] views.py def people(request): return render(request, 'people.html', {'people': models.Person.objects.all()}) models.py class…
jianbo jia
  • 45
  • 6
3
votes
1 answer

django-tables2 exclude & field not working

I'm new to django and stumbling through creating my first site. I'm using django-tables2 to display a table and it appears to be working (the table shows up, it's sortable). Except I can't seem to customize anything. Exclude, field and sequence…
SuperClueless
  • 41
  • 1
  • 4
3
votes
1 answer

'django.template.context_processors.request' issue with django-tables2 and django-admin-tools

I'm having an issue when trying to render a PDF through xhtml2pdf in Django(1.10.4) when using django-admin-tools(0.8.0) & django-tables2(1.5) together. I've done enough reading to understand the basis of what's going on but have not idea how to fix…
Dan2theR
  • 159
  • 2
  • 11
3
votes
1 answer

Column with render_* method in django-tables2 not working

I have a table defined like this using django-tables2: class MyTable(tables.Table): action = tables.Column() class Meta: model = User fields = ['name', 'email'] def render_action(self, record): return 'Foo' But…
Federico B.
  • 941
  • 8
  • 19
3
votes
3 answers

django-tables2 CheckBoxColumn - only header checkbox is generated

I've got a table to generate based on a list of objects and I'd like to show one more column (checkboxcolumn) whose value would be set based on some data in my objects. I tried to use CheckBoxColumn shipped with django-tables2 but it only generates…
Aranha
  • 2,903
  • 3
  • 14
  • 29
3
votes
2 answers

django-tables2 flooding database with queries

im using django-tables2 in order to show values from a database query. And everythings works fine. Im now using Django-dabug-toolbar and was looking through my pages with it. More out of curiosity than performance needs. When a lokked at the page…
user2602386
  • 120
  • 6
3
votes
1 answer

How to make a join with two tables with django-tables2

Can anyone provide a clear example of how to show a table using django-tables2 that selects and presents data from two(or more) related models? I've found lots of posts about that, most of them quite old, and none really a working example. These are…
Max Iskram
  • 147
  • 10
3
votes
1 answer

Django-tables2 column total

I'm trying to sum up all values from column using this documentation, but footer doesn't show up. I'm I missing something? models.py class Mokejimai(models.Model): id = models.AutoField(primary_key=True) nr =…
Gabrielius B.
  • 71
  • 2
  • 4
  • 12
3
votes
2 answers

django-tables2: set attrs for many columns?

I have a django-tables2 Table with many columns. Hence, I don't want to specify each column in the Table class separately, but just set the Model correspondingly. Now, I'd like to change the properties of some columns that I can identify via their…
Phil
  • 43
  • 5
3
votes
1 answer

get rows count from django_tables2

I'm new at django, and I need to get table row count (best it would be if before rendering table) of table which rendered with django table2 in my template have some code like this: {% load render_table from django_tables2 %} {% block content %} …
Scorpioniz
  • 1,421
  • 3
  • 16
  • 36
3
votes
1 answer

Humanizing django-tables2 output?

Here's a hack I'm currently using: class ProductMaxIPPortEldCountMonthlyTable(tables.Table): ip_count = tables.TemplateColumn('{% load humanize %}{{ record.ip_count|intcomma }} ') I'm using django.contrib.humanize. Is…
d33tah
  • 10,999
  • 13
  • 68
  • 158
3
votes
2 answers

How do I control pagination using a class-based view in django-tables2?

I have a view deriving from SingleTableView. Instructions for disabling pagination revolve around using a call to RequestConfig, however I don't have implemented in my view the function that takes the request parameter. I have tried overriding the…
frankster
  • 1,529
  • 2
  • 16
  • 20
3
votes
0 answers

Edit values in django-tables2

How do I edit the values in the fields in django-tables2? This is what I have written in my Tables.py file. It displays edLevel as 6 but field isn't editable any more. TEMPLATE:
Amritha Menon
  • 145
  • 1
  • 2
  • 10