Set admin field short_description dynamically in Django, without trigerring APPS_NOT_READY_WARNING_MSG
I'm encountering the APPS_NOT_READY_WARNING_MSG after updating to Django 5.0. The warning appears in the admin when using a custom field description set via @admin.display().
I need to include these custom columns in my list_display, where they are dynamically calculated based on the current_year retrieved from the database.
Here’s an example from my admin mixin:
from app.models import FiscalYear
class MyAdmin(admin.Modeladmin):
current_fiscal_year = FiscalYear().get_current_fiscal_year()
@admin.display(description=f"FY{current_fiscal_year}")
def total_exercice_courant(self, obj):
total_exercice_n = obj.get_montant_exercice_n(year_n=0)
return format_number_euro(total_exercice_n) if total_exercice_n else "-"
To determine whether the column should be labeled FY24, FY25, etc., I currently make a database call (current_fiscal_year = FiscalYear().get_current_fiscal_fiscal_year())
. However, this call during initialization is causing the issue.
How can i update my admin field short_description later than at import ?