Django

Code

Ticket #13 (reopened)

Opened 3 years ago

Last modified 4 weeks ago

Related objects interface should be tighter (edit_inline)

Reported by: adrian Assigned to: nobody
Component: Admin interface Version: newforms-admin
Keywords: nfa-someday nfa-changelist Cc: oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de, django@julienphalip.com, remco@diji.biz
Triage Stage: Accepted Has patch: 0
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description (Last modified by wilson)

The admin interface for related objects and the ordering interface need some tighter integration.

Currently, anything that can be ordered goes in the right sidebar of the admin change form, with no relation to the actual input fields for those objects.

The adding, removing, editing and ordering of related objects should be tied together in one part of the form.

Specific areas for enhancement:

  • Adding related objects should be easier. Now you have to "save and continue" to get an extra set of fields to add a new related object. You should be able to click "add new object" to add another set of blank fields inline on the page.
  • Deleting related objects should be easier. Now you have to clear the "core fields" of a related object to delete it. You should be able to click "delete" to delete the object, or at least mark it for deletion when you click save on the main object.
  • Ordering of related objects should be clearly tied to editing those objects. Now the ordering interface is completely separate. You should be use the same list of objects to set the order (by dragging) or select that object for editing or deleting (by clicking).

Attachments

Change History

07/14/05 13:44:47 changed by adrian

  • owner changed from adrian to wilson.

07/15/05 14:37:35 changed by wilson

  • description changed.

09/07/05 17:48:01 changed by wilson

Here is a mockup of a proposed interface for related objects (edit_inline).

http://media.wilsonminer.com/images/django/related-objects-mock.gif

Proposed changes (implemented with JS/Ajax):

  • Adding objects: Clicking the "Add another..." link below the related objects would dynamically add a new row with blank fields.
  • Deleting objects: Clicking the "delete" icon next to each related object row would "mark" that object for deletion when you click save. The row would be grayed out, the fields would be disabled. The delete link would transform to a "restore" icon, which would remove that object from the deletion list and reactivate the fields.
  • Ordering objects: Clicking the row outside the field or button areas would allow the entire row to be dragged with a "move" cursor and dropped in a new position in the order.

Obviously, this is a long way from being implemented, and the heavy lifting will need to be done in the javascript, but this should give us a starting point.

09/08/05 11:36:25 changed by Simon Willison

That mockup is very sexy indeed. There needs to be a fallback for when JS isn't available - maybe just a text box with an "order-by-this-number" integer in it that gets hidden when the JS is loaded.

09/08/05 14:10:53 changed by anonymous

That's exactly what I was thinking re: ordering. There would be an integer field at the beginning of each row that would be hidden by the javascript.

I'm not sure what the fallback is for the delete behavior. As I described it, I think it would require some Ajax hooks to store a list of objects to be deleted on save. Maybe just maintain the "clear core fields to delete" method as a noscript fallback.

09/08/05 17:16:57 changed by robert@wittams.com

Surely the fallback can just do multiple "POST"s to the same url, and only the one from the submit button means "Save this object". This could be done with validation in the manipulator I think. (Maybe manipulators need to be expanded to include the state "editing, but not finished", as distinct from errors.)

Then a normal up/down image buttons fallback can be used.

09/08/05 20:38:34 changed by anonymous

Just let the Neanderthals that don't have JS enabled or have a really old browser use the current way of doing things. It's not like it's impossible to do, it's just harder. If you want easier, use a newer browser. Netscape 4 compatibility is too much hassle these days, and should have the lowest possible priority.

09/16/05 16:54:46 changed by wilson

Also, here's a mockup of how edit_inline STACKED would work. This is going to be a little more complicated to set up, but this is the basic idea. Drag and drop the rows to reorder. Click a row to select. The fields on the right would be populated with information for the the currently selected field.

http://media.wilsonminer.com/images/django/related-objects-stacked.gif

09/25/05 17:28:48 changed by jacob

  • milestone set to Version 1.1.

09/26/05 20:36:24 changed by Jason Huggins

1) wilson, can you post a higher res copy of the "X" (delete) icon, so I can patch my own version of Django in the meantime?

2) Would you consider using code from http://script.aculo.us/ to handle the sorting? There is a demo for sortable elements: http://script.aculo.us/demos/ajax/sortable_elements Ignoring the "AJAX" part of it, and only looking at the JavaScript? source code, it looks like it would be very easy to integrate.

01/30/06 21:24:20 changed by jim-django@dsdd.org

Has there been any progress on this since september? The new admin is integrated now, and it looks like the javascript debate has settled on Dojo; is this still being worked on?

01/30/06 23:03:10 changed by jacob

  • owner changed from wilson to jacob.
  • status changed from new to assigned.

Indeed it is -- I've been hacking on this behind the scenes. Expect to see the results pretty soon.

03/08/06 07:17:21 changed by Christopher Lenz <cmlenz@gmx.de>

  • cc set to cmlenz@gmx.de.

07/04/06 22:45:25 changed by hi-world cup

  • cc changed from cmlenz@gmx.de to hi-world, cup.
  • keywords set to rthml tab space editor js.
  • summary changed from Related objects interface should be tighter to hi-world cup.

07/04/06 22:56:54 changed by adrian

  • summary changed from hi-world cup to Related objects interface should be tighter.

10/25/06 15:03:37 changed by Gary Wilson <gary.wilson@gmail.com>

  • cc changed from hi-world, cup to cmlenz@gmx.de, gary.wilson@gmail.com.

restored and added to cc.

11/13/06 16:50:56 changed by Eugene

Hi! Great feature! I've just thinked of this! Is it possible to use it now? What could be done to make this feature ready for use?

12/12/06 06:37:28 changed by anonymous

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com to cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no.

12/14/06 00:29:33 changed by starplant@gmail.com

I would very like to see this implemented!

01/17/07 16:12:34 changed by

  • milestone changed.

Milestone Version 1.1 deleted

01/19/07 11:12:55 changed by Gary Wilson <gary.wilson@gmail.com>

  • keywords deleted.
  • stage changed from Unreviewed to Accepted.

Removed keyword spam. Marking this accepted since many people seem interested, and there aren't really any drawbacks.

01/20/07 00:53:02 changed by taavi223@dedac.com

I wanted to add that if you have 'max_num_in_admin' set to something for the related object then the JS should respect that value to that and not allow you to add more sets of fields once you reach that number. I bring this up, because in certain instances you want to only have one related object. One example that springs to mind are users and profiles, and although you don't have to worry about 2 profiles being saved for a single user (unique = True in the ForeignKey? would throw a validation error), it would be rather confusing if the interface allowed you to have two forms but wouldn't let you save both of them.

Finally, I think that since we're working on this, we should have some way to quickly clear a related object's inline form (perhaps the delete option could double for this). If I have a long form and I fill in all the fields, then decide I don't want to add that related object, I'd have to manually go back clear all the core=True fields, which could be very time consuming, especially if the I don't know which ones they are. Just my 2¢.

02/17/07 23:23:50 changed by Gary Wilson <gary.wilson@gmail.com>

  • keywords set to edit_inline.
  • summary changed from Related objects interface should be tighter to Related objects interface should be tighter (edit_inline).

Thomas Steinacher has posted a link in a comment in #3433 to some code on his web site (that uses the mootools JavaScript library) for adding of a new set of edit_inline fields, though I'm not positive that he gives Django the right to use it.

(follow-up: ↓ 25 ) 02/18/07 02:47:04 changed by Thomas Steinacher <tom@eggdrop.ch>

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no to cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch.

Feel free to use my code in Django. Should I attach the code to this ticket? And it wouldn't be difficult to remove the mootools dependency, if you don't like it.

(in reply to: ↑ 24 ; follow-up: ↓ 26 ) 02/18/07 09:50:30 changed by Gary Wilson <gary.wilson@gmail.com>

Replying to Thomas Steinacher <tom@eggdrop.ch>:

Feel free to use my code in Django. Should I attach the code to this ticket? And it wouldn't be difficult to remove the mootools dependency, if you don't like it.

If you could create a patch to attach to the ticket, that would be very helpful. As far as the mootools dependency, I don't think the core developers want to couple Django to any specific JavaScript? library.

(in reply to: ↑ 25 ) 02/18/07 10:09:32 changed by Thomas Steinacher <tom@eggdrop.ch>

If you could create a patch to attach to the ticket, that would be very helpful. As far as the mootools dependency, I don't think the core developers want to couple Django to any specific JavaScript? library.

Everything I could attach right now are the files that you can already download on my website (dynamicforms.py/js). But I don't have a patch against the Django admin application.

03/22/07 11:06:23 changed by Florian Apolloner <florian@apolloner.eu>

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch to cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu.

03/26/07 15:46:35 changed by brosner <brosner@gmail.com>

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu to cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com.

04/06/07 14:01:19 changed by anonymous

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com to cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl.

05/06/07 03:15:58 changed by anonymous

  • cc changed from cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl.

07/24/07 05:06:09 changed by anonymous

  • version set to 0.96.
  • component changed from Admin interface to Translations.
  • stage changed from Accepted to Design decision needed.

07/24/07 08:54:07 changed by Brian Rosner <brosner@gmail.com>

  • version changed from 0.96 to newforms-admin.
  • component changed from Translations to Admin interface.
  • stage changed from Design decision needed to Accepted.

Reverting spam.

08/28/07 03:36:57 changed by xuefeng8@gmail.com

I would very like to see this implemented! 月餅

(follow-up: ↓ 36 ) 09/13/07 00:48:37 changed by cammmm@gmail.com

+1 for this feature. Can we get a status update? (I may be willing to code this myself)

09/15/07 17:32:32 changed by anonymous

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com.

(in reply to: ↑ 34 ) 09/16/07 06:17:13 changed by ubernostrum

Replying to cammmm@gmail.com:

+1 for this feature. Can we get a status update? (I may be willing to code this myself)

It's being worked on as part of newforms-admin.

09/28/07 20:10:18 changed by anonymous

django is beautiful. compliments

10/15/07 22:59:51 changed by anonymous

  • status changed from assigned to closed.
  • resolution set to fixed.

10/15/07 23:23:35 changed by brosner

  • status changed from closed to reopened.
  • resolution deleted.

This ticket is not fixed, but very close ;) Probably a bot of some sort.

12/01/07 07:15:12 changed by James Wheare <django@sparemint.com>

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com.

12/07/07 03:39:31 changed by lnielsen

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org.

12/07/07 17:00:44 changed by brosner

  • keywords changed from edit_inline to nfa-someday.

Tagging with nfa-someday as this is functionality that is not critical to the merge of the newforms-admin branch.

03/04/08 10:27:16 changed by Patrick Lauber <patrick.lauber@divio.ch>

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, patrick.lauber@divio.ch.

03/06/08 10:44:52 changed by cecil

  • cc deleted.

Well,as you pointed in your story, it's difficult to find a way from this situation. I'm crossing fingers for everybody who is in this situation. Good Luck!

03/06/08 11:00:50 changed by Patrick Lauber <patrick.lauber@divio.ch>

  • cc set to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch.

03/19/08 00:07:29 changed by jakub_vysoky

  • keywords changed from nfa-someday to nfa-someday nfa-changelist.

03/29/08 11:54:09 changed by anonymous

cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl to oliver@obeattie.com, ouzze@yahoo.net, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com.

04/02/08 10:21:24 changed by anonymous

cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl to oliver@obeattie.com, ouzze@yahoo.net, servil@yahoo.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com.

04/02/08 10:23:05 changed by anonymous

cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl to oliver@obeattie.com, ouzze@yahoo.net, servil@yahoo.net!, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com.

04/04/08 12:08:37 changed by Michael P. Jung <mpjung@terreon.de>

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de.

Very sexy interface mock up. :)

04/16/08 17:14:24 changed by julien

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de, django@julienphalip.com.

04/17/08 05:04:04 changed by shanx

  • cc changed from oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de, django@julienphalip.com to oliver@obeattie.com, cmlenz@gmx.de, gary.wilson@gmail.com, mhf@hex.no, tom@eggdrop.ch, django@apolloner.eu, brosner@gmail.com, tom85@lycos.nl, dan.popovici@gmail.com, django@sparemint.com, lnielsen@eso.org, to, patrick.lauber@divio.ch, mpjung@terreon.de, django@julienphalip.com, remco@diji.biz.

Add/Change #13 (Related objects interface should be tighter (edit_inline))




Change Properties
Action