Aaron Trevena wrote:
On 01/02/06, Dave Howorth <[EMAIL PROTECTED]> wrote:
I have delete buttons on more than one page. So when I press a delete
button, I'd like it to redisplay an updated version of the page the
delete button was on, rather than always go to the list view for
whichever table the delete happened to affect.

Does anybody have a way to do this, before I go roll my own?

I haven't needed to do this yet, but I can see that it's something
you'd want to do.

The easiest way is to include the tablename & template in your form
arguments, and then check for them and set the template using them if
appropriate - bearing in mind that the delete action will assume
'list' would be /table_being_deleted_from/list rather than
/table_being_viewed/list

My deletes work the old-fashioned way using the URL path rather than a form, but I could add extra information. It might perhaps get complicated passing the information through sub-templates and macros.

... this could be problematic as you would then presumably need to
populate objects lists, and your url will still say
/other_table/delete - perhaps a redirect based on passed values would
be better, certainly in 2.11/SVN, less easy in 2.10...

.. the other alternative is to add a delete_related_object, that
preserves the arguments a page was called with (table, action,
identifier), as well as being passed the table and identifier for the
related objects, call the delete action on the related_table using the
identifier passed, just as maypole would, and then call the original
action, on the original table with the original identifer.

This is the sort of approach I'll probably go for unless somebody else comes up with another idea. I was wondering about just picking up the referring URL.

I believe it would be quite simple to write a general method to do
this and inherit it in all your model classes, disabling or wrapping
it as required.

Let's hope so!

Cheers, Dave


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users

Reply via email to