Search code examples
pythoncssdjango-tables2

What is the easiest/correct why to change the width of django_tables2 table


I want a table rendered by django-tables2 to be drawn over the whole screen. I'm using the included paleblue css.

class PoolTable(tables.Table):
    class Meta:
        model = Simple 
        attrs = {'class': 'paleblue','width':'100%'}
  • Is it possible to do this fairly easy in the code and if so how?
  • If you can't easily do this in the code, what must I change in the css or html or any other place?

Solution

  • This is more of a css question. Here is how I did it the easy way:

    chang the width to be over 100%

    class PoolTable(tables.Table):
        class Meta:
            model = Simple 
            attrs = {'class': 'paleblue','width':'200%'}
    

    This will only change the size of the table not the pagination. If you wont to change the its size you have to change it in the css. I did find it easiest to just remove the borders from the pagination.