0001-preview-remind-it-was-a-preview-on-last-submit-page-.patch
tests/test_form_pages.py | ||
---|---|---|
2010 | 2010 |
next_page = page.forms[0].submit('submit') |
2011 | 2011 |
assert 'Check values then click submit.' in next_page.body |
2012 | 2012 |
next_page = next_page.forms[0].submit('submit') |
2013 |
assert next_page.status_int == 302
|
|
2014 |
assert next_page.location == 'http://example.net/preview/test/'
|
|
2013 |
assert next_page.status_int == 200
|
|
2014 |
assert 'This was only a preview: form was not actually submitted.' in next_page.body
|
|
2015 | 2015 |
assert len([x for x in formdef.data_class().select() if not x.is_draft()]) == 0 |
2016 | 2016 | |
2017 | 2017 |
def test_form_item_data_source_field_submit(pub): |
wcs/forms/preview.py | ||
---|---|---|
14 | 14 |
# You should have received a copy of the GNU General Public License |
15 | 15 |
# along with this program; if not, see <http://www.gnu.org/licenses/>. |
16 | 16 | |
17 |
from quixote import get_publisher, redirect
|
|
17 |
from quixote import get_publisher |
|
18 | 18 |
from quixote.directory import Directory, AccessControlled |
19 |
from qommon import errors |
|
19 |
from quixote.html import htmltext, TemplateIO |
|
20 |
from qommon import errors, _ |
|
20 | 21 | |
21 | 22 |
from .root import FormPage |
22 | 23 | |
... | ... | |
31 | 32 |
return False |
32 | 33 | |
33 | 34 |
def submitted(self, *args, **kwargs): |
34 |
return redirect('.') |
|
35 |
r = TemplateIO(html=True) |
|
36 |
r += htmltext('<div class="warningnotice"><p>') |
|
37 |
r += _('This was only a preview: form was not actually submitted.') |
|
38 |
r += htmltext(' <a href=".">%s</a>') % _('Start another preview.') |
|
39 |
r += htmltext('</p></div>') |
|
40 |
return r.getvalue() |
|
35 | 41 | |
36 | 42 | |
37 | 43 |
class PreviewDirectory(AccessControlled, Directory): |
38 |
- |