Thanks Federico, it did solved the problem.
On Fri, Apr 17, 2020 at 6:28 AM 'Federico Capoano' via Django users < [email protected]> wrote: > Is this the kind of thing you're looking for? > > https://github.com/openwisp/openwisp-firmware-upgrader/tree/1e9fa26d75a48ae9274c2708ea9a10134a2bb9d0/openwisp_firmware_upgrader/base/admin.py#L150-L186 > > Fed > > > On Wednesday, April 15, 2020 at 4:15:48 PM UTC-5, Gagan Deep wrote: >> >> 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/dd24c6eb-fcaa-41dc-ac78-6f2ba700c5e9%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/dd24c6eb-fcaa-41dc-ac78-6f2ba700c5e9%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAOX69xp0%3DyjN0HdFyGqT5qb5fdoPM8g%2BSvQxEmfgJxtM1Ly5qw%40mail.gmail.com.

