Monday, August 13, 2012

Model method represented as non-editable field on object edit page

Hola,

I have a Person object with

Class Person(model.Models):
...
def get_id(self):
"""
This returns the worker's reference number, or "worker ID"
Think like a social security number
Not kept in the database as it would be extraneous
The 100000 is added for aesthetic reasons only
"""
return self.pk + 100000
get_id.short_description = 'ID Number'

And in my admin.py I have the appropriate

list_display = ('__unicode__','birth_place','get_id')

But what I really want to achieve is for the "get_id" function to
appear on each object's edit page as an uneditable field - so that the
data entry staff have a visual reference

Is it possible to do this?

cheers

L.

--
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