From: Josh Williams Date: Mon, 30 Sep 2013 21:36:38 +0000 (-0400) Subject: Fix slug generation to prevent collisions. X-Git-Tag: release-20150131~386^2~80 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=370ae56c4b5785310263f64751490f06a142ab77;p=oweals%2Fkarmaworld.git Fix slug generation to prevent collisions. --- diff --git a/karmaworld/apps/notes/models.py b/karmaworld/apps/notes/models.py index 5644649..5365130 100644 --- a/karmaworld/apps/notes/models.py +++ b/karmaworld/apps/notes/models.py @@ -76,7 +76,7 @@ class Document(models.Model): """ generate a unique slug based on name and uploaded_at """ _slug = defaultfilters.slugify(self.name) klass = self.__class__ - collision = klass.objects.filter(slug=self.slug) + collision = klass.objects.filter(slug=_slug) if collision: _slug = u"{0}-{1}-{2}-{3}".format( _slug, self.uploaded_at.month,