From a5c09e0fc7fb3b95afa3fd6c683731553ccbc451 Mon Sep 17 00:00:00 2001 From: Aaron Kable Date: Thu, 8 Jan 2026 18:21:03 +0800 Subject: [PATCH] Add more detail to docs --- .../development/custom/framework/datatables.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/development/custom/framework/datatables.md b/docs/development/custom/framework/datatables.md index 3493f802..1f4b1765 100644 --- a/docs/development/custom/framework/datatables.md +++ b/docs/development/custom/framework/datatables.md @@ -121,6 +121,24 @@ Given the `EveCharacter` Model as our model of choice we would define our stubs Then we can setup out view in our `appname/views.py` file. +### Columns definition + +The `columns` must be defined as a 2 part tuple + +- Part 1 is the database field that will be used for filtering and ordering. If this is a foreign key you need to point to a field that is compatible with `__icontains` like `charField` or `textField`. It can be `None`/`False`/`""` if no ordering for filtering is required for this row. + - Examples for the EveCharacter Model: + - `character_name` + - `character_ownership__user__username` + - `character_ownership__user__profile__main_character__character_name` +- Part 2 is a string that is used to the render the column for each row. This can be a html stub or a string containing django style template language. + - Examples for the EveCharacter Model + - `{{ row.character_name }}` + - `{{ row.character_ownership.user.username }}` + - `{{ row.character_ownership.user.profile.main_character.character_name }}` + - `appname/stubs/character_img.html` + +### appname/views.py + ```python from django.shortcuts import render # Alliance Auth