0001-backoffice-display-message-on-global-statistics-when.patch
tests/test_backoffice_pages.py | ||
---|---|---|
802 | 802 |
assert '<h2>Filters</h2>' in resp.body |
803 | 803 |
assert 'End: 2013-01-01' in resp.body |
804 | 804 | |
805 |
def test_backoffice_statistics_with_no_formdefs(pub): |
|
806 |
create_user(pub) |
|
807 |
create_environment(pub) |
|
808 |
FormDef.wipe() |
|
809 |
if pub.is_using_postgresql(): |
|
810 |
from wcs.sql import get_connection_and_cursor, drop_global_views |
|
811 |
conn, cur = get_connection_and_cursor() |
|
812 |
drop_global_views(conn, cur) |
|
813 |
conn.commit() |
|
814 |
cur.close() |
|
815 | ||
816 |
app = login(get_app(pub)) |
|
817 |
resp = app.get('/backoffice/management/').follow() |
|
818 |
resp = resp.click('Global statistics') |
|
819 |
assert 'This site is currently empty.' in resp.body |
|
820 | ||
805 | 821 |
def test_backoffice_statistics_status_filter(pub): |
806 | 822 |
create_superuser(pub) |
807 | 823 |
create_environment(pub) |
wcs/backoffice/management.py | ||
---|---|---|
608 | 608 |
def statistics(self): |
609 | 609 |
html_top('management', _('Global statistics')) |
610 | 610 |
get_response().breadcrumb.append(('statistics', _('Global statistics'))) |
611 | ||
612 |
if FormDef.count() == 0: |
|
613 |
r = TemplateIO(html=True) |
|
614 |
r += htmltext('<div class="top-title">') |
|
615 |
r += htmltext('<h2>%s</h2>') % _('Global statistics') |
|
616 |
r += htmltext('</div>') |
|
617 |
r += htmltext('<div class="big-msg-info">') |
|
618 |
r += htmltext('<p>%s</p>') % _( |
|
619 |
'This site is currently empty. It is required to first add forms.') |
|
620 |
r += htmltext('</div>') |
|
621 |
return r.getvalue() |
|
622 | ||
611 | 623 |
get_response().filter['sidebar'] = self.get_stats_sidebar() |
612 | 624 |
r = TemplateIO(html=True) |
613 | 625 |
r += htmltext('<h2>%s</h2>') % _('Global statistics') |
614 |
- |