Greetings of the day,
I have defined a model admin inheriting from admin.ModelAdmin class. There
is one of the fields which I want to show on the admin dashboard which is a
function. I read in Django docs that for a callable function to be a field,
it should be added in readonly_fields. So far, it was working great. The
problem arose when I mentioned that callable field in the fieldset.
This worked fine:
class Myadmin(admin.ModelAdmin):
readonly_fields = ('my_callable_field', )
fields = ('my_callable_field' )
But, doing this popped Unknown field(s) (my_callable_field) specified for
<model>. Check fields/fieldsets/exclude attributes of class Myadmin
class Myadmin(admin.ModelAdmin):
readonly_fields = ('my_callable_field', )
fieldsets = (
(None, {'fields': ('my_callable_field',)}),
)
I don't understand why this is happening.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9184abd2-f9cb-47f2-b0dd-0153da12fee9%40googlegroups.com.