Custom submit buttons on admin form

3 views
Skip to first unread message

Delta20

unread,
Oct 15, 2008, 5:08:17 PM10/15/08
to Django developers
What's the cleanest way to customize the submit buttons that appear on
an admin change_form? If there's a way to override submit_row on
change_form, that would be the simplest approach, I think, but I'm
very much a django beginner so I would appreciate some guidance.

To provide some context, here's what I'm trying to achieve in doing
this:

The model FieldReport represents some raw data that, if an
administrator deems it useful, they use it as the basis of creating an
"Article". The desired functionality is:

a) When a FieldReport is viewed in admin, there are two submit buttons
"Accept" and "Reject"

b) If the "Accept" button is clicked, go to the Article admin/edit
form to create a new Article, with the various FieldReport fields
copied into the relevant Article fields.

The obvious way to do this seems to be to create a custom admin
change_form template with the two submit buttons then create a view
function for each of these buttons, with accept just displaying the
standard change_form for the new Article, but I'm wondering if there's
a better approach.


James Bennett

unread,
Oct 15, 2008, 7:26:19 PM10/15/08
to django-d...@googlegroups.com
This question belongs on the django-users list; in the future, please
keep in mind that this list is for discussion of actually developing
Django itself, while django-users is for discussion of how to use
Django.


--
"Bureaucrat Conrad, you are technically correct -- the best kind of correct."

Delta20

unread,
Oct 15, 2008, 8:41:47 PM10/15/08
to Django developers
Oops... my apologies; this is what happens when I open two different
forums in separate tabs!
Reply all
Reply to author
Forward
0 new messages