Merge pull request #830 from ostcar/issue-822
Use get_active_version in motion.__unicode__()
This commit is contained in:
commit
5fdea2f213
@ -100,7 +100,7 @@ class Motion(SlideMixin, models.Model):
|
||||
"""
|
||||
Return a human readable name of this motion.
|
||||
"""
|
||||
return self.active_version.title
|
||||
return self.get_active_version().title
|
||||
|
||||
# TODO: Use transaction
|
||||
def save(self, use_version=None, *args, **kwargs):
|
||||
|
@ -146,6 +146,12 @@ class ModelTest(TestCase):
|
||||
motion.save(use_version=False)
|
||||
self.assertEqual(motion.versions.count(), 2)
|
||||
|
||||
def test_unicode_with_no_active_version(self):
|
||||
motion = Motion.objects.create(title='foo', text='bar', identifier='')
|
||||
motion.active_version = None
|
||||
motion.save(update_fields=['active_version'])
|
||||
self.assertEqual(str(motion), 'foo') # motion.__unicode__() did rais an AttributeError
|
||||
|
||||
|
||||
class ConfigTest(TestCase):
|
||||
def test_stop_submitting(self):
|
||||
|
Loading…
Reference in New Issue
Block a user