Fix slug generation to prevent collisions.
authorJosh Williams <jwilliams@endpoint.com>
Mon, 30 Sep 2013 21:36:38 +0000 (17:36 -0400)
committerJosh Williams <jwilliams@endpoint.com>
Mon, 30 Sep 2013 21:36:38 +0000 (17:36 -0400)
karmaworld/apps/notes/models.py

index 56446494978e7de54a23c39be7be87092fd007df..536513063e4249fa11c12d490329e809fe9795a3 100644 (file)
@@ -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,