Can't slugify a PositiveSmallIntegerField

Issue #24 new
C E created an issue

I am pointing an AutoSlugField at a field that represents an integer, and it seems to result in an error. The problem comes from calling any of the unicode decoders, it seems. Ironically enough, the value to be slugified might need to be wrapped in a unicode() call.

class Thing(models.Model):
    number = models.PositiveSmallIntegerField(unique=True, blank=False)
    slug = AutoSlugField(always_update=True, populate_from='number')

I have disabled the always_update option, since I loaded these models early on, and they are generally static. This solves my problem, for now. I imagine the change needs to happen in utils.py but I haven't spent enough time to understand the best place for it. This likely could be alleviated by changing the slug structure, so I'm open to this being a weird edge case.

Comments (0)

  1. Log in to comment