logged-errors: enable thousand separator (#55815)

This commit is contained in:
Lauréline Guérin 2021-07-27 12:00:41 +02:00
parent 5e83d9ebcb
commit bc4112b4c5
No known key found for this signature in database
GPG Key ID: 1FAB9B9B4F93D473
4 changed files with 9 additions and 2 deletions

View File

@ -110,6 +110,7 @@ def test_listing_paginations(pub):
error = pub.loggederror_class()
error.summary = 'Lonely Logged Error'
error.first_occurence_timestamp = datetime.datetime.now()
error.occurences_count = 17654032
error.store()
create_superuser(pub)
@ -121,6 +122,7 @@ def test_listing_paginations(pub):
resp = app.get('/backoffice/studio/logged-errors/')
assert '1-20/67' in resp.text
assert resp.text.count('Lonely Logged Error') == 1
assert '<span class="badge">17,654,032</span>' in resp.text
assert resp.text.count('Logged Error n°') == 19
resp = resp.click(href=r'\?offset=60')
assert '61-67/67' in resp.text

View File

@ -14,6 +14,7 @@
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
from django.utils.formats import number_format
from django.utils.timezone import now
from wcs.carddef import CardDef
@ -175,3 +176,7 @@ class LoggedError:
if status_item.id == self.status_item_id:
return status_item
return None
@property
def formatted_occurences_count(self):
return number_format(self.occurences_count, force_grouping=True)

View File

@ -9,7 +9,7 @@
<ul>
<li>{% trans "First occurence:" %} {{ error.first_occurence_timestamp }}</li>
<li>{% trans "Latest occurence:" %} {{ error.latest_occurence_timestamp }}</li>
<li>{% trans "Count:" %} {{ error.occurences_count }}</li>
<li>{% trans "Count:" %} {{ error.formatted_occurences_count }}</li>
{% if formdef %}
<li>{{ formdef.verbose_name }}{% trans ":" %} <a href="{{ formdef.get_admin_url }}">{{ formdef.name }}</a></li>
{% endif %}

View File

@ -10,7 +10,7 @@
{% if error.exception_class or error.exception_message %}
<span class="extra-info">- {{error.exception_class}} ({{error.exception_message}}</span>
{% endif %}
</a><span class="badge">{{ error.occurences_count }}</span></li>
</a><span class="badge">{{ error.formatted_occurences_count }}</span></li>
{% endfor %}
</ul>
{{ pagination_links|safe }}