[Catalyst] Slug Generator?
Kevin at RawFedDogs.net
Fri Feb 22 23:32:37 GMT 2013
On Fri, Feb 22, 2013 at 07:25:00PM -0300, Hernan Lopes wrote:
> that will do it
It looks like that would handle simple cases where the slug is being
generated from a unique column. But, life usually isn't simple. Here are
some examples from my site, which is currently Django based and using
Czar, Czar-2, Czar-3, etc., are the slugs for the photo model. The slug
field is defined as:
Slug = AutoSlugField(populate_from='Title',
All of the above photos have the same title - Czar. AutoSlug adds the
numbers to the end of the slug if needed to make them unique. The photo
model is polymorphic. Photos can be attached to albums, recipes, and/or
terms. unique_with=['content_type', 'object_id'] causes AutoSlug to check
the parent's ID and type when determining if the slug is unique or not.
What's the definition of a legacy system? One that works!
Errare humanum est, ignoscere caninum.
More information about the Catalyst