Formatting
This commit is contained in:
parent
57c8695bcc
commit
c980567fee
@ -45,6 +45,4 @@ class Command(BaseCommand):
|
|||||||
.exists()
|
.exists()
|
||||||
)
|
)
|
||||||
|
|
||||||
self.stdout.write(
|
self.stdout.write(self.style.SUCCESS(f"{migration} {admin} {whitelabel}"))
|
||||||
self.style.SUCCESS(f"{migration} {admin} {whitelabel}")
|
|
||||||
)
|
|
||||||
|
@ -304,9 +304,9 @@ class Service(models.Model):
|
|||||||
|
|
||||||
chart_data = sorted(chart_data.items(), key=lambda k: k[0])
|
chart_data = sorted(chart_data.items(), key=lambda k: k[0])
|
||||||
chart_data = {
|
chart_data = {
|
||||||
'sessions': [v['sessions'] for k, v in chart_data],
|
"sessions": [v["sessions"] for k, v in chart_data],
|
||||||
'hits': [v['hits'] for k, v in chart_data],
|
"hits": [v["hits"] for k, v in chart_data],
|
||||||
'labels': [str(k) for k, v in chart_data],
|
"labels": [str(k) for k, v in chart_data],
|
||||||
}
|
}
|
||||||
|
|
||||||
return chart_data, chart_tooltip_format, chart_granularity
|
return chart_data, chart_tooltip_format, chart_granularity
|
||||||
|
@ -26,34 +26,34 @@ class DateRangeMixin:
|
|||||||
now = timezone.now()
|
now = timezone.now()
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
'name': 'Last 3 days',
|
"name": "Last 3 days",
|
||||||
'start': now - timezone.timedelta(days=2),
|
"start": now - timezone.timedelta(days=2),
|
||||||
'end': now,
|
"end": now,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Last 30 days',
|
"name": "Last 30 days",
|
||||||
'start': now - timezone.timedelta(days=29),
|
"start": now - timezone.timedelta(days=29),
|
||||||
'end': now,
|
"end": now,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Last 90 days',
|
"name": "Last 90 days",
|
||||||
'start': now - timezone.timedelta(days=89),
|
"start": now - timezone.timedelta(days=89),
|
||||||
'end': now,
|
"end": now,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'This month',
|
"name": "This month",
|
||||||
'start': now.replace(day=1),
|
"start": now.replace(day=1),
|
||||||
'end': now,
|
"end": now,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'Last month',
|
"name": "Last month",
|
||||||
'start': now.replace(day=1, month=now.month - 1),
|
"start": now.replace(day=1, month=now.month - 1),
|
||||||
'end': now.replace(day=1, month=now.month) - timezone.timedelta(days=1),
|
"end": now.replace(day=1, month=now.month) - timezone.timedelta(days=1),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'name': 'This year',
|
"name": "This year",
|
||||||
'start': now.replace(day=1, month=1),
|
"start": now.replace(day=1, month=1),
|
||||||
'end': now,
|
"end": now,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ class ContextualURLNode(template.Node):
|
|||||||
|
|
||||||
if self.urlnode.asvar:
|
if self.urlnode.asvar:
|
||||||
context[self.urlnode.asvar] = url_final
|
context[self.urlnode.asvar] = url_final
|
||||||
return ''
|
return ""
|
||||||
else:
|
else:
|
||||||
return url_final
|
return url_final
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ def percent(value, total):
|
|||||||
if percent < 0.001:
|
if percent < 0.001:
|
||||||
return "<0.1%"
|
return "<0.1%"
|
||||||
|
|
||||||
return f'{percent:.1%}'
|
return f"{percent:.1%}"
|
||||||
|
|
||||||
|
|
||||||
@register.simple_tag
|
@register.simple_tag
|
||||||
@ -272,4 +272,4 @@ def bar_width(count, max, total):
|
|||||||
if percent < 0.001:
|
if percent < 0.001:
|
||||||
return "0"
|
return "0"
|
||||||
|
|
||||||
return f'{percent:.1%}'
|
return f"{percent:.1%}"
|
||||||
|
Loading…
Reference in New Issue
Block a user