0001-backoffice-display-message-on-global-statistics-when.patch
tests/test_backoffice_pages.py | ||
---|---|---|
984 | 984 |
assert '<h2>Filters</h2>' in resp.body |
985 | 985 |
assert 'End: 2013-01-01' in resp.body |
986 | 986 | |
987 |
def test_backoffice_statistics_with_no_formdefs(pub): |
|
988 |
create_user(pub) |
|
989 |
create_environment(pub) |
|
990 |
FormDef.wipe() |
|
991 |
if pub.is_using_postgresql(): |
|
992 |
from wcs.sql import get_connection_and_cursor, drop_global_views |
|
993 |
conn, cur = get_connection_and_cursor() |
|
994 |
drop_global_views(conn, cur) |
|
995 |
conn.commit() |
|
996 |
cur.close() |
|
997 | ||
998 |
app = login(get_app(pub)) |
|
999 |
resp = app.get('/backoffice/management/statistics') |
|
1000 |
assert 'This site is currently empty.' in resp.body |
|
1001 | ||
987 | 1002 |
def test_backoffice_statistics_status_filter(pub): |
988 | 1003 |
create_superuser(pub) |
989 | 1004 |
create_environment(pub) |
wcs/backoffice/management.py | ||
---|---|---|
674 | 674 |
def statistics(self): |
675 | 675 |
html_top('management', _('Global statistics')) |
676 | 676 |
get_response().breadcrumb.append(('statistics', _('Global statistics'))) |
677 | ||
678 |
if FormDef.count() == 0: |
|
679 |
r = TemplateIO(html=True) |
|
680 |
r += htmltext('<div class="top-title">') |
|
681 |
r += htmltext('<h2>%s</h2>') % _('Global statistics') |
|
682 |
r += htmltext('</div>') |
|
683 |
r += htmltext('<div class="big-msg-info">') |
|
684 |
r += htmltext('<p>%s</p>') % _( |
|
685 |
'This site is currently empty. It is required to first add forms.') |
|
686 |
r += htmltext('</div>') |
|
687 |
return r.getvalue() |
|
688 | ||
677 | 689 |
get_response().filter['sidebar'] = self.get_stats_sidebar() |
678 | 690 |
r = TemplateIO(html=True) |
679 | 691 |
r += htmltext('<h2>%s</h2>') % _('Global statistics') |
680 |
- |