Krys Wilken <[EMAIL PROTECTED]> writes: > What makes a slug field interesting is the validation/auto text processing.
I didn't get why you want to validate this. > Hmm... Now that I am thinking of it, a slug could be viewed simply as a > regexp text processing of another given field. As such, a generic > function could slugify any given text. (Perhaps chopping it off after a > certain upper limit.) How about an MD5 or SHA1 or some other hash from any one or two fields (one can be a date, for example)? > That function is something that TG could provide and it would be generic > enough to be applied to any StringCol field in any model. Just StringCols? Why not UnicodeCol, IntCol, etc.? > Anyway, I'm just typing as I'm thinking. I don't have the time to > implement this idea, so I am throwing it out there for anyone to run with. myinstance.mySlug = md5.md5(myinstance.myCol).hexdigest() ? >>> import md5 >>> slug = md5.md5('this is a test').hexdigest() >>> slug '54b0c58c7ce9f2a8b551351102ee0938' >>> slug = md5.md5('1').hexdigest() >>> slug 'c4ca4238a0b923820dcc509a6f75849b' >>> slug = md5.md5('áéíóúçã').hexdigest() >>> slug 'a88a39ed784a18cccc9d87fd0e7f48d9' >>> import datetime >>> slug = md5.md5(str(datetime.datetime.now())).hexdigest() >>> slug '684a0195179447705f07fc205f32f74c' >>> Be seeing you, -- Jorge Godoy <[EMAIL PROTECTED]>