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
f3a56d57
authored
Aug 20, 2010
by
Alex Gaynor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reorder things for easier readability
parent
d16b83b4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
13 deletions
+14
-13
taggit/tests/models.py
+14
-13
No files found.
taggit/tests/models.py
View file @
f3a56d57
...
...
@@ -3,6 +3,7 @@ from django.db import models
from
taggit.managers
import
TaggableManager
from
taggit.models
import
TaggedItemBase
class
Food
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
...
...
@@ -19,23 +20,23 @@ class Pet(models.Model):
def
__unicode__
(
self
):
return
self
.
name
class
HousePet
(
Pet
):
trained
=
models
.
BooleanField
()
# test direct-tagging with custom through model
# Test direct-tagging with custom through model
class
TaggedFood
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'DirectFood'
)
class
TaggedPet
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'DirectPet'
)
class
DirectFood
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
tags
=
TaggableManager
(
through
=
TaggedFood
)
class
TaggedPet
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'DirectPet'
)
class
DirectPet
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
)
...
...
@@ -43,16 +44,19 @@ class DirectPet(models.Model):
def
__unicode__
(
self
):
return
self
.
name
class
DirectHousePet
(
DirectPet
):
trained
=
models
.
BooleanField
()
# test custom through model to model with custom PK
# Test custom through model to model with custom PK
class
TaggedCustomPKFood
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'CustomPKFood'
)
class
TaggedCustomPKPet
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'CustomPKPet'
)
class
CustomPKFood
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
,
primary_key
=
True
)
...
...
@@ -60,10 +64,7 @@ class CustomPKFood(models.Model):
def
__unicode__
(
self
):
return
self
.
name
class
TaggedCustomPKPet
(
TaggedItemBase
):
content_object
=
models
.
ForeignKey
(
'CustomPKPet'
)
class
CustomPKPet
(
models
.
Model
):
name
=
models
.
CharField
(
max_length
=
50
,
primary_key
=
True
)
...
...
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