Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
This is a fork of django-tagging!

(http://code.google.com/p/django-tagging/
or
http://github.com/clones/django-tagging)

THE MAIN AND CURRENTLY ONLY DIFFERENCE TO THE ORIGIN BRANCH IS THAT
THERE IS A SETTINGS OPTION CALLED

FORCE_COMMA_SEPARATOR

IF ITS TRUE; django-tagging USES COMMA AS SEPARATOR ALWAYS!
I NEED THIS FOR django-tagging-autocomplete!



==============
Django Tagging
==============
Expand All @@ -7,4 +23,4 @@ This is a generic tagging application for Django projects
For installation instructions, see the file "INSTALL.txt" in this
directory; for instructions on how to use this application, and on
what it provides, see the file "overview.txt" in the "docs/"
directory.
directory.
4 changes: 4 additions & 0 deletions tagging/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@
# Whether to force all tags to lowercase before they are saved to the
# database.
FORCE_LOWERCASE_TAGS = getattr(settings, 'FORCE_LOWERCASE_TAGS', False)

#If its True comme is used separator always.(ie for AutoCompleteTagField)
FORCE_COMMA_SEPARATOR = getattr(settings, 'FORCE_COMMA_SEPARATOR', False)

8 changes: 5 additions & 3 deletions tagging/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from django.db.models.query import QuerySet
from django.utils.encoding import force_unicode
from django.utils.translation import ugettext as _
import settings

# Python 2.3 compatibility
try:
Expand All @@ -31,7 +32,7 @@ def parse_tag_input(input):
# Special case - if there are no commas or double quotes in the
# input, we don't *do* a recall... I mean, we know we only need to
# split on spaces.
if u',' not in input and u'"' not in input:
if u',' not in input and u'"' not in input and not settings.FORCE_COMMA_SEPARATOR :
words = list(set(split_strip(input, u' ')))
words.sort()
return words
Expand Down Expand Up @@ -75,10 +76,11 @@ def parse_tag_input(input):
saw_loose_comma = True
to_be_split.append(u''.join(buffer))
if to_be_split:
if saw_loose_comma:
if saw_loose_comma or settings.FORCE_COMMA_SEPARATOR:
delimiter = u','
else:
delimiter = u' '

for chunk in to_be_split:
words.extend(split_strip(chunk, delimiter))
words = list(set(words))
Expand Down Expand Up @@ -110,7 +112,7 @@ def edit_string_for_tags(tags):
it will be space-delimited.
"""
names = []
use_commas = False
use_commas = settings.FORCE_COMMA_SEPARATOR
for tag in tags:
name = tag.name
if u',' in name:
Expand Down