flebel / django-tagging

Automatically exported from code.google.com/p/django-tagging
Other
0 stars 0 forks source link

Additional tag formats; verbose name #35

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It would be useful provide update_tags functionality for additional tag
formats when importing data from other services.  Off the top of my head:

Flickr style: tag "tag with a space" othertag
CSV (LibraryThing, among others) style: tag?,tag with a space,othertag!

The Flickr double-quotes style could be added to the existing regex and by
doing a quick transform from spaces to slug-style hypens (-).  The regex
would then be something like:

find_tag_re = re.compile('(?P[-\w]+)|\"(?P[-\w ]+)\"', re.U)
(I added capturing groups to keep the "" quotes out of the returned tag.)

and then with the tags just do a quick tag_name.replace(' ','-')

For the CSV style it would be useful to provide some quick flag to switch
to "real CSV style" and run django's slugify() to clean gunk like
non-alphanumeric characters for the final tag name.

I can flesh this out into a full patch in a few days if there is interest.
 I'll probably be writing it for my own use in the near future anyway.

It would also be nice to support "verbose names" for tags where spaces
might look cleaner/nicer or be more preferred as the non-URL display name.

Original issue reported on code.google.com by max.batt...@gmail.com on 19 May 2007 at 9:23

GoogleCodeExporter commented 9 years ago
any progress on this? i've been banging my head against the "tag with a space"
problem, and though i had solved it by using a ManyToManyField, but then i have 
to
manually add each TaggedItem as i lose the TagField functionality.

Original comment by kenbol...@gmail.com on 1 Jun 2007 at 5:13

GoogleCodeExporter commented 9 years ago

Original comment by jonathan.buchanan on 29 Dec 2007 at 3:14

GoogleCodeExporter commented 9 years ago
This appears to be mostly handled by the code for parsing tag strings with 
quotations
and/or commas and could probably be closed.  "Verbose names" as mentioned above 
is
not necessary, and instead consider it another vote for adding a "slug" field 
to Tag.

Original comment by max.batt...@gmail.com on 21 Feb 2008 at 9:06