views:

87

answers:

2

Hi all,

Currently, i have a class MyAdmin(admin.ModelAdmin), and i have a field in there called name, which belongs to both list_editable and list_display. The current behavior is such that all fields that is in list_editable displays a form field. However, i would like to change that only when people click on the field would it turn into a editable form field.

Can anyone point me in the right direction on how to do that (which template to edit etc.).

Thank you very much!

Jason

A: 

Maybe something like that http://www.appelsiini.net/projects/jeditable points you in the right direction?

lazerscience
A: 

Look at list_editable in model.ModelAdmin. The way I solved click to edit is to use some javascript wizardry to display the edit field only if the user clicks on the field.

FurtiveFelon
For the JavaScript end of things, you may want to consider the Ajax.InPlaceEditor class (http://wiki.github.com/madrobby/scriptaculous/ajax-inplaceeditor) from script.aculo.us (http://script.aculo.us/). This class handles text fields, and Ajax.InPlaceCollectionEditor (http://wiki.github.com/madrobby/scriptaculous/ajax-inplacecollectioneditor) handles selection menus.
Mike DeSimone