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
983f0833
authored
Mar 13, 2013
by
Florian Apolloner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #43 -- Made tag names unique.
parent
ac50c9ad
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
1 deletions
+47
-1
CHANGES.rst
+2
-0
taggit/migrations/0002_unique_tagnames.py
+44
-0
taggit/models.py
+1
-1
No files found.
CHANGES.rst
View file @
983f0833
Version 0.10 (unreleased)
Version 0.10 (unreleased)
-------------------------
-------------------------
* Tag names are unique now, use the provided South migrations to upgrade.
Version 0.9.3
Version 0.9.3
-------------
-------------
...
...
taggit/migrations/0002_unique_tagnames.py
0 → 100644
View file @
983f0833
# -*- coding: utf-8 -*-
import
datetime
from
south.db
import
db
from
south.v2
import
SchemaMigration
from
django.db
import
models
class
Migration
(
SchemaMigration
):
def
forwards
(
self
,
orm
):
# Adding unique constraint on 'Tag', fields ['name']
db
.
create_unique
(
u'taggit_tag'
,
[
'name'
])
def
backwards
(
self
,
orm
):
# Removing unique constraint on 'Tag', fields ['name']
db
.
delete_unique
(
u'taggit_tag'
,
[
'name'
])
models
=
{
u'contenttypes.contenttype'
:
{
'Meta'
:
{
'ordering'
:
"('name',)"
,
'unique_together'
:
"(('app_label', 'model'),)"
,
'object_name'
:
'ContentType'
,
'db_table'
:
"'django_content_type'"
},
'app_label'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
u'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'model'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'max_length'
:
'100'
})
},
u'taggit.tag'
:
{
'Meta'
:
{
'object_name'
:
'Tag'
},
u'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'name'
:
(
'django.db.models.fields.CharField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'100'
}),
'slug'
:
(
'django.db.models.fields.SlugField'
,
[],
{
'unique'
:
'True'
,
'max_length'
:
'100'
})
},
u'taggit.taggeditem'
:
{
'Meta'
:
{
'object_name'
:
'TaggedItem'
},
'content_type'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"u'taggit_taggeditem_tagged_items'"
,
'to'
:
u"orm['contenttypes.ContentType']"
}),
u'id'
:
(
'django.db.models.fields.AutoField'
,
[],
{
'primary_key'
:
'True'
}),
'object_id'
:
(
'django.db.models.fields.IntegerField'
,
[],
{
'db_index'
:
'True'
}),
'tag'
:
(
'django.db.models.fields.related.ForeignKey'
,
[],
{
'related_name'
:
"u'taggit_taggeditem_items'"
,
'to'
:
u"orm['taggit.Tag']"
})
}
}
complete_apps
=
[
'taggit'
]
\ No newline at end of file
taggit/models.py
View file @
983f0833
...
@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _, ugettext
...
@@ -7,7 +7,7 @@ from django.utils.translation import ugettext_lazy as _, ugettext
class
TagBase
(
models
.
Model
):
class
TagBase
(
models
.
Model
):
name
=
models
.
CharField
(
verbose_name
=
_
(
'Name'
),
max_length
=
100
)
name
=
models
.
CharField
(
verbose_name
=
_
(
'Name'
),
unique
=
True
,
max_length
=
100
)
slug
=
models
.
SlugField
(
verbose_name
=
_
(
'Slug'
),
unique
=
True
,
max_length
=
100
)
slug
=
models
.
SlugField
(
verbose_name
=
_
(
'Slug'
),
unique
=
True
,
max_length
=
100
)
def
__unicode__
(
self
):
def
__unicode__
(
self
):
...
...
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