Creates slug, checks if slug is unique, and loop if not

def create_slug(self):
        """
        Creates slug, checks if slug is unique, and loop if not
        """
        name = self.slug_source
        counter = 0
        # loops until slug is unique
        while True:
            if counter == 0:
                slug = slugify(name)
            else:
                # using the counter var to bump the slug name
                slug = slugify('{0} {1}'.format(name, str(counter)))
            try:
                # does the slug already exist, excluding the current object
                self.__class__.objects.exclude(pk=self.pk).get(slug=slug)
                # if slug exists increment counter and loop
                counter += 1
            except ObjectDoesNotExist:
                # the slug does not exist
                # we can break from the loop
                break
        return slug