Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
internewshid
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
aptivate
client-projects
internewshid
Commits
943d2e5e
Commit
943d2e5e
authored
9 years ago
by
Martin Burchell
Browse files
Options
Downloads
Plain Diff
Merge branch 'multiple_taxonomies' into add_multiple_terms_api
parents
c262b4e1
f619188f
No related branches found
Branches containing commit
No related tags found
2 merge requests
!46
Tagging frontend
,
!45
Add multiple terms api
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
django/website/taxonomies/models.py
+8
-4
8 additions, 4 deletions
django/website/taxonomies/models.py
django/website/taxonomies/tests/taxonomy_tests.py
+14
-0
14 additions, 0 deletions
django/website/taxonomies/tests/taxonomy_tests.py
with
22 additions
and
4 deletions
django/website/taxonomies/models.py
+
8
−
4
View file @
943d2e5e
...
...
@@ -24,10 +24,6 @@ class Taxonomy(models.Model):
self
.
slug
=
slugify
(
self
.
name
)
super
(
Taxonomy
,
self
).
save
(
*
args
,
**
kwargs
)
@property
def
is_optional
(
self
):
return
self
.
multiplicity
==
'
optional
'
def
__unicode__
(
self
):
return
self
.
name
...
...
@@ -42,6 +38,14 @@ class Taxonomy(models.Model):
max_length
=
30
,
)
@property
def
is_optional
(
self
):
return
self
.
multiplicity
==
'
optional
'
@property
def
is_multiple
(
self
):
return
self
.
multiplicity
==
'
multiple
'
vocabulary
=
models
.
CharField
(
choices
=
(
(
'
fixed
'
,
_
(
'
Not modifiable by any user, system only
'
)),
...
...
This diff is collapsed.
Click to expand it.
django/website/taxonomies/tests/taxonomy_tests.py
+
14
−
0
View file @
943d2e5e
...
...
@@ -52,6 +52,20 @@ def test_is_optional_false_for_multiplicity_multiple():
assert
not
taxonomy
.
is_optional
@pytest.mark.django_db
def
test_is_multiple_false_for_multiplicity_optional
():
taxonomy
=
TaxonomyFactory
(
multiplicity
=
'
optional
'
)
assert
not
taxonomy
.
is_multiple
@pytest.mark.django_db
def
test_is_multiple_true_for_multiplicity_multiple
():
taxonomy
=
TaxonomyFactory
(
multiplicity
=
'
multiple
'
)
assert
taxonomy
.
is_multiple
@pytest.mark.django_db
def
test_is_open_true_for_vocabulary_open
():
taxonomy
=
TaxonomyFactory
(
vocabulary
=
'
open
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment