From c682832ea1149d47d375033bc4fc2e2a613f3cd5 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Mon, 9 Nov 2015 14:15:53 +0200 Subject: Force unique on location name --- servo/models/common.py | 12 +++++++----- 1 file 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" -- cgit v1.2.3