aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2015-11-09 14:15:53 +0200
committerFilipp Lepalaan <filipp@mac.com>2015-11-09 14:15:53 +0200
commitc682832ea1149d47d375033bc4fc2e2a613f3cd5 (patch)
tree1591630acc6a90ee748aac9461a4ddafacaf3977
parent38f69b156cdf1f10ea237984f5c88b362fbb51b7 (diff)
downloadServo-c682832ea1149d47d375033bc4fc2e2a613f3cd5.tar.gz
Servo-c682832ea1149d47d375033bc4fc2e2a613f3cd5.tar.bz2
Servo-c682832ea1149d47d375033bc4fc2e2a613f3cd5.zip
Force unique on location name
-rw-r--r--servo/models/common.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/servo/models/common.py b/servo/models/common.py
index 9b6e082..03942db 100644
--- a/servo/models/common.py
+++ b/servo/models/common.py
@@ -375,6 +375,7 @@ class Location(models.Model):
title = models.CharField(
max_length=255,
+ unique=True,
verbose_name=_(u'Name'),
default=_('New Location'),
)
@@ -393,19 +394,19 @@ class Location(models.Model):
blank=True,
default='',
max_length=32,
- verbose_name=_(u'Address')
+ verbose_name=_('Address')
)
zip_code = models.CharField(
blank=True,
default='',
max_length=8,
- verbose_name=_(u'ZIP Code')
+ verbose_name=_('ZIP Code')
)
city = models.CharField(
blank=True,
default='',
max_length=16,
- verbose_name=_(u'City')
+ verbose_name=_('City')
)
TIMEZONES = tuple((t, t) for t in common_timezones)
@@ -663,7 +664,7 @@ class Notification(models.Model):
"""
A notification is a user-configurable response to an event
"""
- KINDS = (('order', u'Tilaus'), ('note', u'Merkintä'))
+ KINDS = (('ORDER', _('Order')), ('NOTE', _('Note')),)
ACTIONS = (('created', u'Luotu'), ('edited', u'Muokattu'))
kind = models.CharField(max_length=16)
@@ -754,10 +755,11 @@ class Attachment(BaseItem):
pass
def get_absolute_url(self):
+ return reverse("files-view_file", args=[self.pk])
return "/files/%d/view" % self.pk
class Meta:
- app_label = 'servo'
+ app_label = "servo"
get_latest_by = "id"