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
268bc3b1
authored
Dec 08, 2009
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added slug to Tag.
parent
83b520da
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
taggit/models.py
+7
-0
No files found.
taggit/models.py
View file @
268bc3b1
from
django.contrib.contenttypes.models
import
ContentType
from
django.contrib.contenttypes.generic
import
GenericForeignKey
from
django.db
import
models
from
django.template.defaultfilters
import
slugify
class
Tag
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
100
)
slug
=
models
.
SlugField
()
def
__unicode__
(
self
):
return
self
.
name
def
save
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
pk
:
self
.
slug
=
slugify
(
self
.
name
)
super
(
Tag
,
self
)
.
save
(
*
args
,
**
kwargs
)
class
TaggedItem
(
models
.
Model
):
object_id
=
models
.
IntegerField
()
...
...
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