Closed biostu24 closed 1 year ago
Ah this is a misunderstanding - ComputedModelsAdmin
is not a special admin view class for computed models, but a helper admin class to get introspection into defined computed fields and their deps during development. You can activate the admin helper classes by setting COMPUTEDFIELDS_ADMIN = True
in your settings.py.
Computed models have no dedicated admin view class, as I saw no need for this - in the end computed fields are just readonly fields on the model, so you can add/view them in admin as any other readonly field.
Thanks very much for the clarification. COMPUTEDFIELDS_ADMIN = True
is what I am looking for.
I tried to add a
ComputedFieldsModel
to the admin site usingComputedModelsAdmin
to show the computed field, however, I can't figure out how to use this class as I get an error. It would be helpful if usage instructions were added to the documentation.This is how I tried to set up the
admin.py
file:In the example above, I can see my
ComputedFieldsModel
on the summary of the admin site but when clicking on the model, I get'ComputedModel' object has no attribute 'app_label'
. I tried adding anapp_label
attribute to my model but this did not work. I believe I'm not using the ComputedAdmin class correctly. Any help would be greatly appreciated.