Skip to content
Snippets Groups Projects
Commit 943d2e5e authored by Martin Burchell's avatar Martin Burchell
Browse files

Merge branch 'multiple_taxonomies' into add_multiple_terms_api

parents c262b4e1 f619188f
No related branches found
No related tags found
2 merge requests!46Tagging frontend,!45Add multiple terms api
......@@ -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')),
......
......@@ -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')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment