Saturday, July 21, 2012

Re: How to present a calculated field in a admin edit form.

On Mon, Jul 16, 2012 at 3:45 AM, Erlend Dalen <erlend.dalen@gmail.com> wrote:
I'm using Django 1.0 (beta_1) and have the following issue:
I have a method in a model that returns a calculated value and I would like this value to be displayed in the admin edit form related to that view.
I have no problem showing the field in the list_display, but if I add it to fields in the fields property in the ModelAdmin, I get an error message saying that there is no such key.

Is there an easy way of solving this?

You can do this with readonly_fields in admin:https://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.readonly_fields

You'll need to upgrade from that ancient level of Django though, readonly_fields were introduced in 1.2.

Karen

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate