1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Move configure_table() logic to NetBoxTable.configure()

This commit is contained in:
jeremystretch
2022-02-09 14:10:54 -05:00
parent 10e6ae2094
commit 23a80770e1
13 changed files with 65 additions and 66 deletions

View File

@ -35,3 +35,14 @@ class MyModelTable(NetBoxTable):
fields = ('pk', 'id', 'name', ...)
default_columns = ('pk', 'name', ...)
```
### Table Configuration
The NetBoxTable class supports dynamic configuration to support pagination and to effect user preferences. To configure a table for a specific request, simply call its `configure()` method and pass the current HTTPRequest object. For example:
```python
table = MyModelTable(data=MyModel.objects.all())
table.configure(request)
```
If using a generic view provided by NetBox, table configuration is handled automatically.