don't cast ugettext_lazy calls to str, as our json encoder is now clever
This commit is contained in:
parent
2d292844d6
commit
a7c140a2ac
7 changed files with 26 additions and 28 deletions
|
@ -97,7 +97,7 @@ class AccessRestrictionMixin(SerializableMixin, models.Model):
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].extend([
|
result['display'].extend([
|
||||||
(str(_('Access Restriction')), self.access_restriction_id and self.access_restriction.title),
|
(_('Access Restriction'), self.access_restriction_id and self.access_restriction.title),
|
||||||
])
|
])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@ class SerializableMixin(models.Model):
|
||||||
return {
|
return {
|
||||||
'id': self.pk,
|
'id': self.pk,
|
||||||
'display': [
|
'display': [
|
||||||
(str(_('Type')), str(self.__class__._meta.verbose_name)),
|
(_('Type'), str(self.__class__._meta.verbose_name)),
|
||||||
(str(_('ID')), str(self.pk)),
|
(_('ID'), str(self.pk)),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class LevelGeometryMixin(GeometryMixin):
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].insert(3, (
|
result['display'].insert(3, (
|
||||||
str(_('Level')),
|
_('Level'),
|
||||||
{
|
{
|
||||||
'id': self.level_id,
|
'id': self.level_id,
|
||||||
'slug': self.level.get_slug(),
|
'slug': self.level.get_slug(),
|
||||||
|
@ -120,8 +120,8 @@ class Space(LevelGeometryMixin, SpecificLocation, models.Model):
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].extend([
|
result['display'].extend([
|
||||||
(str(_('height')), self.height),
|
(_('height'), self.height),
|
||||||
(str(_('outside only')), str(_('Yes') if self.outside else _('No'))),
|
(_('outside only'), _('Yes') if self.outside else _('No')),
|
||||||
])
|
])
|
||||||
result['editor_url'] = reverse('editor.spaces.detail', kwargs={'level': self.level_id, 'pk': self.pk})
|
result['editor_url'] = reverse('editor.spaces.detail', kwargs={'level': self.level_id, 'pk': self.pk})
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -60,7 +60,7 @@ class SpaceGeometryMixin(GeometryMixin):
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].insert(3, (
|
result['display'].insert(3, (
|
||||||
str(_('Space')),
|
_('Space'),
|
||||||
{
|
{
|
||||||
'id': self.space_id,
|
'id': self.space_id,
|
||||||
'slug': self.space.get_slug(),
|
'slug': self.space.get_slug(),
|
||||||
|
|
|
@ -79,10 +79,10 @@ class Level(SpecificLocation, models.Model):
|
||||||
|
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].insert(3, (str(_('short label')), self.short_label))
|
result['display'].insert(3, (_('short label'), self.short_label))
|
||||||
result['display'].extend([
|
result['display'].extend([
|
||||||
(str(_('outside only')), self.base_altitude),
|
(_('outside only'), self.base_altitude),
|
||||||
(str(_('default height')), self.default_height),
|
(_('default height'), self.default_height),
|
||||||
])
|
])
|
||||||
result['editor_url'] = reverse('editor.levels.detail', kwargs={'pk': self.pk})
|
result['editor_url'] = reverse('editor.levels.detail', kwargs={'pk': self.pk})
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -61,7 +61,7 @@ class LocationSlug(SerializableMixin, models.Model):
|
||||||
|
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].insert(2, (str(_('Slug')), str(self.get_slug())))
|
result['display'].insert(2, (_('Slug'), str(self.get_slug())))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
@ -105,8 +105,8 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model):
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].extend([
|
result['display'].extend([
|
||||||
(str(_('searchable')), str(_('Yes') if self.can_search else _('No'))),
|
(_('searchable'), _('Yes') if self.can_search else _('No')),
|
||||||
(str(_('can describe')), str(_('Yes') if self.can_describe else _('No')))
|
(_('can describe'), _('Yes') if self.can_describe else _('No'))
|
||||||
])
|
])
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -262,10 +262,10 @@ class LocationGroup(Location, models.Model):
|
||||||
|
|
||||||
def details_display(self):
|
def details_display(self):
|
||||||
result = super().details_display()
|
result = super().details_display()
|
||||||
result['display'].insert(3, (str(_('Category')), self.category.title))
|
result['display'].insert(3, (_('Category'), self.category.title))
|
||||||
result['display'].extend([
|
result['display'].extend([
|
||||||
(str(_('color')), self.color),
|
(_('color'), self.color),
|
||||||
(str(_('priority')), self.priority),
|
(_('priority'), self.priority),
|
||||||
])
|
])
|
||||||
result['editor_url'] = reverse('editor.locationgroups.edit', kwargs={'pk': self.pk})
|
result['editor_url'] = reverse('editor.locationgroups.edit', kwargs={'pk': self.pk})
|
||||||
return result
|
return result
|
||||||
|
|
|
@ -237,10 +237,8 @@ class CustomLocation:
|
||||||
self.level = level
|
self.level = level
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
self.title = str(_('Coordinates'))
|
self.title = _('Coordinates')
|
||||||
self.subtitle = str(_('%(level)s, x=%(x)s, y=%(y)s') % {'level': self.level.title,
|
self.subtitle = _('%(level)s, x=%(x)s, y=%(y)s') % {'level': self.level.title, 'x': self.x, 'y': self.y}
|
||||||
'x': self.x,
|
|
||||||
'y': self.y})
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def serialized_geometry(self):
|
def serialized_geometry(self):
|
||||||
|
@ -268,19 +266,19 @@ class CustomLocation:
|
||||||
return {
|
return {
|
||||||
'id': self.pk,
|
'id': self.pk,
|
||||||
'display': [
|
'display': [
|
||||||
(str(_('Type')), str(_('Coordinates'))),
|
(_('Type'), _('Coordinates')),
|
||||||
(str(_('ID')), str(self.pk)),
|
(_('ID'), self.pk),
|
||||||
(str(_('Slug')), str(self.pk)),
|
(_('Slug'), self.pk),
|
||||||
(str(_('Level')), {
|
(_('Level'), {
|
||||||
'id': self.level.pk,
|
'id': self.level.pk,
|
||||||
'slug': self.level.get_slug(),
|
'slug': self.level.get_slug(),
|
||||||
'title': self.level.title,
|
'title': self.level.title,
|
||||||
'can_search': self.level.can_search,
|
'can_search': self.level.can_search,
|
||||||
}),
|
}),
|
||||||
(str(_('X Coordinate')), str(self.x)),
|
(_('X Coordinate'), str(self.x)),
|
||||||
(str(_('Y Coordinate')), str(self.y)),
|
(_('Y Coordinate'), str(self.y)),
|
||||||
(str(_('Title')), str(self.title)),
|
(_('Title'), self.title),
|
||||||
(str(_('Subtitle')), str(self.subtitle)),
|
(_('Subtitle'), self.subtitle),
|
||||||
],
|
],
|
||||||
'geometry': self.serialized_geometry,
|
'geometry': self.serialized_geometry,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue