Override the change_view in the admin

/ Published in: Django
Save to your folder(s)

Adding another button with name "addnextid" would trigger our custom action, that redirects the user to the changeform screen for the next available item (by ID).

Then you can override admin/submit_line.html. Copy the version in contrib.admin.templates into your project. Mine is myproject/templates/admin/submit_line.html, but you could use /myproject/myapp/templates/admin/submit_line.html.

Next, edit the copy and add the code for showing the 'Save and edit next item (by ID)' link, which is caught via the "_addnextid" name.

The submit_line.html template is called in change_form.html via the {% submit_row %} tag.

URL: https://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L445

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.