server/python/django2/renkanmanager/models.py
changeset 611 f0f07e2b841f
parent 610 b9edc1c1538a
child 614 23416a833ca8
--- a/server/python/django2/renkanmanager/models.py	Tue May 03 14:32:28 2016 +0200
+++ b/server/python/django2/renkanmanager/models.py	Tue Jun 07 10:44:41 2016 +0200
@@ -9,6 +9,7 @@
 from django.db import models, transaction
 from django.core.exceptions import ValidationError
 from django.utils import timezone, dateparse
+from django.utils.translation import ugettext_lazy as _
 
 
 
@@ -120,6 +121,12 @@
         else:
             return ''
     
+    def __unicode__(self):
+        return self.renkan_guid
+    
+    def __str__(self):
+        return self.renkan_guid
+    
     @transaction.atomic
     def save_renkan(self, updator, timestamp="", title="", content="", create_new_revision=False):
         """
@@ -128,7 +135,7 @@
         """
         if (not timestamp) or ((self.current_revision is not None) and dateparse.parse_datetime(timestamp) < self.current_revision.modification_date):
             logger.error("SAVING RENKAN: provided timestamp is %r, which isn't current revision modification_date %r", timestamp, self.current_revision.modification_date)
-            raise ValidationError(message="Error saving Renkan: provided timestamp isn't current revision modification_date")
+            raise ValidationError(_("Cannot save, provided timestamp is invalid"))
         else:
             dt_timestamp = dateparse.parse_datetime(timestamp)
         self.save()