From b8334054d908e8c49bdbd8ac28ab2c9e7b37a937 Mon Sep 17 00:00:00 2001 From: Stephen Burrows Date: Wed, 27 Apr 2011 12:33:58 -0400 Subject: [PATCH] Updated page admin/add form to use the same method for redirection as the 1.3 user admin. --- admin/pages.py | 6 +++++ templates/admin/philo/page/add_form.html | 29 ++++++------------------ 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/admin/pages.py b/admin/pages.py index 13d4098..f9e96c0 100644 --- a/admin/pages.py +++ b/admin/pages.py @@ -46,6 +46,12 @@ class PageAdmin(ViewAdmin): list_filter = ('template',) search_fields = ['title', 'contentlets__content'] inlines = [ContentletInline, ContentReferenceInline] + ViewAdmin.inlines + + def response_add(self, request, obj, post_url_continue='../%s/'): + # Shamelessly cribbed from django/contrib/auth/admin.py:143 + if '_addanother' not in request.POST and '_popup' not in request.POST: + request.POST['_continue'] = 1 + return super(PageAdmin, self).response_add(request, obj, post_url_continue) class TemplateAdmin(TreeAdmin): diff --git a/templates/admin/philo/page/add_form.html b/templates/admin/philo/page/add_form.html index 67f6ec4..b2a6358 100644 --- a/templates/admin/philo/page/add_form.html +++ b/templates/admin/philo/page/add_form.html @@ -1,29 +1,14 @@ {% extends "admin/change_form.html" %} {% load i18n %} -{% block extrahead %}{{ block.super }} - - -{% endblock %} - {% block form_top %} -

{% trans "First, choose a template. After saving, you'll be able to provide additional content for containers." %}

- + {% if not is_popup %} +

{% trans "First, choose a template. After saving, you'll be able to provide additional content for containers." %}

+ {% else %} +

{% trans "Choose a template" %}

+ {% endif %} {% endblock %} -{% block content %} -{% with 0 as save_on_top %} -{{ block.super }} -{% endwith %} +{% block after_field_sets %} + {% endblock %} \ No newline at end of file -- 2.20.1