Commits

Andy Mikhailenko committed d3b577c Merge

Merge

  • Participants
  • Parent commits f79357a, ce7150b

Comments (0)

Files changed (1)

File autoslug/utils.py

     while True:
         # find instances with same slug
         lookups = dict(default_lookups, **{field.name: slug})
-        rivals = manager.filter(**lookups).exclude(pk=instance.pk)
+        rivals = manager.filter(**lookups)
+        if instance.pk:
+            rivals = rivals.exclude(pk=instance.pk)
 
         if not rivals:
             # the slug is unique, no model uses it