Skip to content

Commit

Permalink
fix: provide a way to override an entities list table
Browse files Browse the repository at this point in the history
Closes: #400
  • Loading branch information
b1rger committed Nov 9, 2023
1 parent ebc8158 commit 6fcb2e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apis_core/apis_entities/tables.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import django_tables2 as tables
from django.utils.safestring import mark_safe
from django_tables2.utils import A
from apis_core.utils.settings import list_links_to_edit
from apis_core.utils.settings import list_links_to_edit, get_entity_settings_by_modelname

from apis_core.apis_metainfo.tables import (
generic_order_start_date_written,
Expand Down Expand Up @@ -69,4 +69,5 @@ class Meta:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

return GenericEntitiesTable
entity_settings = get_entity_settings_by_modelname(entity)
return entity_settings.get("table", GenericEntitiesTable)
1 change: 1 addition & 0 deletions docs/source/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ allows to merge several entities in one target entity at once.
``form_order`` defines the order of the fields in the metadata form of the respective entity.
``form`` allows you to set a custom form for the entity, instead of the default `apis_entities.forms.GenericEntityForm`
``table_fields`` sets the default columns to show in the list views.
``table`` allows you to set a custom table class for the list view of the entity, instead of the default :class:`apis_core.apis_entities.tables.get_entities_table.GenericEntitiesTable`
``additional_cols`` allows to set the columns that user can add to the result view.
``relations_per_page`` allows to set the number of relations listed before pagination begins
``detail_view_exclude`` allows to set fields that are excluded from the default detail view
Expand Down

0 comments on commit 6fcb2e0

Please sign in to comment.