0001-logged-errors-enable-thousand-separator-55815.patch
tests/admin_pages/test_logged_errors.py | ||
---|---|---|
110 | 110 |
error = pub.loggederror_class() |
111 | 111 |
error.summary = 'Lonely Logged Error' |
112 | 112 |
error.first_occurence_timestamp = datetime.datetime.now() |
113 |
error.occurences_count = 17654032 |
|
113 | 114 |
error.store() |
114 | 115 | |
115 | 116 |
create_superuser(pub) |
... | ... | |
121 | 122 |
resp = app.get('/backoffice/studio/logged-errors/') |
122 | 123 |
assert '1-20/67' in resp.text |
123 | 124 |
assert resp.text.count('Lonely Logged Error') == 1 |
125 |
assert '<span class="badge">17,654,032</span>' in resp.text |
|
124 | 126 |
assert resp.text.count('Logged Error n°') == 19 |
125 | 127 |
resp = resp.click(href=r'\?offset=60') |
126 | 128 |
assert '61-67/67' in resp.text |
wcs/logged_errors.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 django.utils.formats import number_format |
|
17 | 18 |
from django.utils.timezone import now |
18 | 19 | |
19 | 20 |
from wcs.carddef import CardDef |
... | ... | |
175 | 176 |
if status_item.id == self.status_item_id: |
176 | 177 |
return status_item |
177 | 178 |
return None |
179 | ||
180 |
@property |
|
181 |
def formatted_occurences_count(self): |
|
182 |
return number_format(self.occurences_count, force_grouping=True) |
wcs/templates/wcs/backoffice/logged-error.html | ||
---|---|---|
9 | 9 |
<ul> |
10 | 10 |
<li>{% trans "First occurence:" %} {{ error.first_occurence_timestamp }}</li> |
11 | 11 |
<li>{% trans "Latest occurence:" %} {{ error.latest_occurence_timestamp }}</li> |
12 |
<li>{% trans "Count:" %} {{ error.occurences_count }}</li> |
|
12 |
<li>{% trans "Count:" %} {{ error.formatted_occurences_count }}</li>
|
|
13 | 13 |
{% if formdef %} |
14 | 14 |
<li>{{ formdef.verbose_name }}{% trans ":" %} <a href="{{ formdef.get_admin_url }}">{{ formdef.name }}</a></li> |
15 | 15 |
{% endif %} |
wcs/templates/wcs/backoffice/logged-errors.html | ||
---|---|---|
10 | 10 |
{% if error.exception_class or error.exception_message %} |
11 | 11 |
<span class="extra-info">- {{error.exception_class}} ({{error.exception_message}}</span> |
12 | 12 |
{% endif %} |
13 |
</a><span class="badge">{{ error.occurences_count }}</span></li> |
|
13 |
</a><span class="badge">{{ error.formatted_occurences_count }}</span></li>
|
|
14 | 14 |
{% endfor %} |
15 | 15 |
</ul> |
16 | 16 |
{{ pagination_links|safe }} |
17 |
- |