7
7
from django .contrib .contenttypes .fields import GenericForeignKey , GenericRelation
8
8
from django .contrib .contenttypes .models import ContentType
9
9
from django .db import connections , models
10
+ from django .utils .translation import gettext_lazy as _
10
11
from django_hosts .resolvers import reverse
11
12
12
13
from tracdb .models import Ticket
15
16
METRIC_PERIOD_DAILY = "daily"
16
17
METRIC_PERIOD_WEEKLY = "weekly"
17
18
METRIC_PERIOD_CHOICES = (
18
- (METRIC_PERIOD_INSTANT , "Instant" ),
19
- (METRIC_PERIOD_DAILY , "Daily" ),
20
- (METRIC_PERIOD_WEEKLY , "Weekly" ),
19
+ (METRIC_PERIOD_INSTANT , _ ( "Instant" ) ),
20
+ (METRIC_PERIOD_DAILY , _ ( "Daily" ) ),
21
+ (METRIC_PERIOD_WEEKLY , _ ( "Weekly" ) ),
21
22
)
22
23
23
24
@@ -26,7 +27,7 @@ class Category(models.Model):
26
27
position = models .PositiveSmallIntegerField (default = 1 )
27
28
28
29
class Meta :
29
- verbose_name_plural = "categories"
30
+ verbose_name_plural = _ ( "categories" )
30
31
31
32
def __str__ (self ):
32
33
return self .name
@@ -94,7 +95,7 @@ def _gather_data_instant(self, since):
94
95
95
96
def _gather_data_periodic (self , since , period ):
96
97
"""
97
- Gather data from "periodic" merics .
98
+ Gather data from "periodic" metrics .
98
99
99
100
Period metrics are reset every day/week/month and count up as the period
100
101
goes on. Think "commits today" or "new tickets this week".
@@ -183,25 +184,29 @@ class JenkinsFailuresMetric(Metric):
183
184
"""
184
185
185
186
jenkins_root_url = models .URLField (
186
- verbose_name = "Jenkins instance root URL" ,
187
+ verbose_name = _ ( "Jenkins instance root URL" ) ,
187
188
max_length = 1000 ,
188
- help_text = "E.g. http://ci.djangoproject.com/" ,
189
+ help_text = _ ( "E.g. http://ci.djangoproject.com/" ) ,
189
190
)
190
191
build_name = models .CharField (
191
192
max_length = 100 ,
192
- help_text = "E.g. Django Python3" ,
193
+ help_text = _ ( "E.g. Django Python3" ) ,
193
194
)
194
195
is_success_cnt = models .BooleanField (
195
196
default = False ,
196
- verbose_name = "Should the metric be a value representing success ratio?" ,
197
- help_text = "E.g. if there are 50 tests of which 30 are failing the value "
198
- "of this metric will be 20 (or 40%.)" ,
197
+ verbose_name = _ ("Should the metric be a value representing success ratio?" ),
198
+ help_text = _ (
199
+ "E.g. if there are 50 tests of which 30 are failing the value "
200
+ "of this metric will be 20 (or 40%.)"
201
+ ),
199
202
)
200
203
is_percentage = models .BooleanField (
201
204
default = False ,
202
- verbose_name = "Should the metric be a percentage value?" ,
203
- help_text = "E.g. if there are 50 tests of which 30 are failing the value of "
204
- "this metric will be 60%." ,
205
+ verbose_name = _ ("Should the metric be a percentage value?" ),
206
+ help_text = _ (
207
+ "E.g. if there are 50 tests of which 30 are failing the value of "
208
+ "this metric will be 60%."
209
+ ),
205
210
)
206
211
207
212
def urljoin (self , * parts ):
0 commit comments