Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
django-taggit
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d6c45659
authored
Oct 19, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The abstraction we needed already exists.
parent
f759697f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
taggit/models.py
+1
-0
taggit/tests/models.py
+5
-4
No files found.
taggit/models.py
View file @
d6c45659
...
...
@@ -32,6 +32,7 @@ class TagBase(models.Model):
trans_kwargs
=
{}
i
=
0
while
True
:
i
+=
1
try
:
sid
=
transaction
.
savepoint
(
**
trans_kwargs
)
res
=
super
(
TagBase
,
self
)
.
save
(
*
args
,
**
kwargs
)
...
...
taggit/tests/models.py
View file @
d6c45659
...
...
@@ -123,7 +123,8 @@ class ArticleTag(Tag):
proxy
=
True
def
slugify
(
self
,
tag
,
i
=
None
):
slug
=
"category-
%
s"
%
tag
slug
=
"category-
%
s"
%
tag
.
lower
()
if
i
is
not
None
:
slug
+=
"-
%
d"
%
i
return
slug
...
...
@@ -132,9 +133,9 @@ class ArticleTaggedItem(TaggedItem):
class
Meta
:
proxy
=
True
# Basically we want to overide the tag ForeignKey to point at the proxy
# inherited ArticleTag so we can get the right slugify, unfortunately I
# can't seem to figure out how to do this, so we're on hold ATM.
@classmethod
def
tag_model
(
self
):
return
ArticleTag
class
Article
(
models
.
Model
):
title
=
models
.
CharField
(
max_length
=
100
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment