2018-01-16 06:58:15 +01:00
|
|
|
# HG changeset patch
|
|
|
|
# Parent 7c95aad3b60e4c2006c5f706bd157e8e05318bfa
|
|
|
|
|
|
|
|
diff --git a/openacademy/models.py b/openacademy/models.py
|
|
|
|
--- a/openacademy/models.py
|
|
|
|
+++ b/openacademy/models.py
|
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
from datetime import timedelta
|
2018-03-14 10:18:18 +01:00
|
|
|
-from flectra import models, fields, api, exceptions
|
|
|
|
+from flectra import models, fields, api, exceptions, _
|
2018-01-16 06:58:15 +01:00
|
|
|
|
|
|
|
class Course(models.Model):
|
|
|
|
_name = 'openacademy.course'
|
|
|
|
@@ -19,11 +19,11 @@ class Course(models.Model):
|
|
|
|
default = dict(default or {})
|
|
|
|
|
|
|
|
copied_count = self.search_count(
|
|
|
|
- [('name', '=like', u"Copy of {}%".format(self.name))])
|
|
|
|
+ [('name', '=like', _(u"Copy of {}%").format(self.name))])
|
|
|
|
if not copied_count:
|
|
|
|
- new_name = u"Copy of {}".format(self.name)
|
|
|
|
+ new_name = _(u"Copy of {}").format(self.name)
|
|
|
|
else:
|
|
|
|
- new_name = u"Copy of {} ({})".format(self.name, copied_count)
|
|
|
|
+ new_name = _(u"Copy of {} ({})").format(self.name, copied_count)
|
|
|
|
|
|
|
|
default['name'] = new_name
|
|
|
|
return super(Course, self).copy(default)
|
|
|
|
@@ -79,15 +79,15 @@ class Session(models.Model):
|
|
|
|
if self.seats < 0:
|
|
|
|
return {
|
|
|
|
'warning': {
|
|
|
|
- 'title': "Incorrect 'seats' value",
|
|
|
|
- 'message': "The number of available seats may not be negative",
|
|
|
|
+ 'title': _("Incorrect 'seats' value"),
|
|
|
|
+ 'message': _("The number of available seats may not be negative"),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
if self.seats < len(self.attendee_ids):
|
|
|
|
return {
|
|
|
|
'warning': {
|
|
|
|
- 'title': "Too many attendees",
|
|
|
|
- 'message': "Increase seats or remove excess attendees",
|
|
|
|
+ 'title': _("Too many attendees"),
|
|
|
|
+ 'message': _("Increase seats or remove excess attendees"),
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
@@ -133,4 +133,4 @@ class Session(models.Model):
|
|
|
|
def _check_instructor_not_in_attendees(self):
|
|
|
|
for r in self:
|
|
|
|
if r.instructor_id and r.instructor_id in r.attendee_ids:
|
|
|
|
- raise exceptions.ValidationError("A session's instructor can't be an attendee")
|
|
|
|
+ raise exceptions.ValidationError(_("A session's instructor can't be an attendee"))
|