On Aug 15, 9:14 pm, Russell Keith-Magee <freakboy3...@gmail.com>
wrote:
> On Sat, Aug 15, 2009 at 3:52 PM, Haroldo
>
> Stenger<harold.sten...@gmail.com> wrote:
> >  I've seen the admin evolve to very sophisticated user interaction.
> > Nonetheless, the param to  HttpResponse() when a model object has been
> > saved, is hardcoded and most of the times "../../.." or "../.."  (see
> > options.py in contrib.admin).
>
> This is a historical artefact. As of v1.1, the 'right way' to do this
> would be to use a named URL pattern. Some of the usages of '../..'
> paths have been corrected, but there are still some remaining. It
> doesn't harm anything while they remain, but I expect that they will
> eventually get cleaned up.
>
> > Being able to change that string by some means
> > of instantiation or runtime configuration, could allow a view to use the
> > admin to edit an object, and once the model object has been saved modified,
> > automatically return to the view (or another view registered in URLconf). I
> > wonder if this has ben thought before, and if there would be much resistance
> > to a change in that HttpResponse's parameter flexibility.
>
> I'm not sure I see why this parameter needs to be configurable. When
> you save an object, it goes back to the list of objects of the same
> type. I can't think of any other logical place for the view to
> redirect.
>
> It sounds like you're trying to use the admin edit views within your
> own application. If this is the case, let me advise you that Django's
> admin isn't intended as a way to avoid writing edit views for your own
> site. If you want to edit objects in your own site, just write write
> edit views - it isn't that hard to use a modelform.
>
> If you have another use case, I'd be interested to hear it.
>
> Yours,
> Russ Magee %-)

About a year ago (pre-Django 1.0) I had posted a ticket with a similar
request: http://code.djangoproject.com/ticket/8001

I agree that the redirection shouldn't be hardcoded. This is
inconsistent because some views allow for customisation (with the
'post_url_continue' parameter) but other views don't.

Haroldo, maybe the posted patch would be a good starting point for
your problem?

Russ, one use case that I've had is with a menu app. I wanted to have
an integrated way to manage items in a menu, for example with the
following URLs:
http://blah.com/admin/menus/menu/1/additem/
http://blah.com/admin/menus/menu/1/items/3/

To edit/add items, I used an unregistered ModelAdmin class to benefit
from all the admin machinery. It worked fine except that the default
hardcoded redirection didn't allow for it, so I had to overwrite some
bits in the views. Not a huge deal, but it's one of those little
customisation hooks that make life easier ;)

Cheers,

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

Reply via email to