|
List Info
Thread: Make Django admin edit return to custom page?
|
|
| Make Django admin edit return to custom
page? |

|
2007-12-29 02:55:27 |
Hi all,
I'm using Django to build a repository of scientific
publications at
my university.
Now we need to edit publication records that have been
supplied by our
departments and imported into the database.
I would like to be able to use the excellent Django admin
interface
for this editing, but my problem is that I would like my
editors to be
able to start from a custom-made list of publications that
need
editing and then return back to this custom list, after
having edited
a record in the admin interface.
The default behavior of the admin edit is to return the user
to a
neutral listing of the type of records being edited. Is
there a way to
change this behavior and make it return to another page,
preferably
using some kind of dynamic referrer parameter?
Sorry if this is an admin FAQ, but I have not been able to
locate any
info about it.
Regards,
Ulf
--~--~---------~--~----~------------~-------~--~----~
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 htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Make Django admin edit return to
custom page? |
  Australia |
2008-01-02 15:57:53 |
On Sat, 2007-12-29 at 00:55 -0800, Ulf Kronman wrote:
> Hi all,
> I'm using Django to build a repository of scientific
publications at
> my university.
>
> Now we need to edit publication records that have been
supplied by our
> departments and imported into the database.
>
> I would like to be able to use the excellent Django
admin interface
> for this editing, but my problem is that I would like
my editors to be
> able to start from a custom-made list of publications
that need
> editing and then return back to this custom list, after
having edited
> a record in the admin interface.
>
> The default behavior of the admin edit is to return the
user to a
> neutral listing of the type of records being edited. Is
there a way to
> change this behavior and make it return to another
page, preferably
> using some kind of dynamic referrer parameter?
The admin interface isn't really designed to be customised
like that.
Rather, the principle is that if you can edit one record,
you can edit
them all.
However, a bit of reading of the source -- in particular,
contrib.admin.views.main -- will reveal some approaches that
could be
used if you really wanted to. For example, the change_stage
view (which,
along with add_stage() is used to process a model
submission) sends the
user back to "../" upon success. So you could
write a custom URLConf
entry that overrides that URL
(admin/<app_name>/<model>/) and presented
them with the page you want to show them.
That sort of thing requires a little bit of planning out,
but I can say
from exprience that it generally works out fairly well.
There's a little
bit of duplication, since you need to write a view that is
almost, but
not quite, exactly like the standard admin view. However,
you can use
the normal admin templates and everything.
It takes a little bit of tiem to get this to work, but it's
not
impossible.
Regards,
Malcolm
--
Atheism is a non-prophet organization.
http://www.pointy-s
tick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
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 htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
| Re: Make Django admin edit return to
custom page? |

|
2008-01-03 09:01:00 |
Hi Malcom,
and thanks for the reply.
> The admin interface isn't really designed to be
customised like that.
> Rather, the principle is that if you can edit one
record, you can edit
> them all.
OK, I guessed that I would get that answer, but I took a
chance
anyhow.
> However, a bit of reading of the source -- in
particular,
> contrib.admin.views.main -- will reveal some approaches
that could be
> used if you really wanted to. For example, the
change_stage view (which,
> along with add_stage() is used to process a model
submission) sends the
> user back to "../" upon success. So you could
write a custom URLConf
> entry that overrides that URL
(admin/<app_name>/<model>/) and presented
> them with the page you want to show them.
That could be a solution to my problem. If I understand you
right
here, I should write a URLConf that in my case intercepts
the URL /
admin/publications/publication/ and points to a view that
redirects
the user to the page he started from before editing the
record in the
admin interface. I guess the address of the starting point
has to be
stored as a session parameter, if I want it to be dynamic.
I also believe that I have to find a clever URL capturer for
my custom
view, since I also want to be able to point back to the
original /
admin/publications/publication/ list, if the user did not
start from
the custom list, but actually came from the
/admin/publications/
publication/, but I don't want it to loop, of course. It
looks as if
the admin list view accepts the URL both with or without an
ending
slash, but the edit form always returns to the list with an
ending
slash, so maybe that little difference in the URLs could do
the trick.
I'll get back with a report, if I get it working.
Thanks for your help,
Ulf
--~--~---------~--~----~------------~-------~--~----~
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 htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---
|
|
[1-3]
|
|