Merge pull request #1431 from ostcar/fix_anonymous

fix #1430 - anonymous user and motion detail view
This commit is contained in:
Oskar Hahn 2015-01-25 01:39:35 +01:00
commit 19fb7018af
4 changed files with 24 additions and 3 deletions

View File

@ -14,7 +14,7 @@ def test(args=None):
Runs the tests. Runs the tests.
""" """
module = getattr(args, 'module', '') module = getattr(args, 'module', '')
return call("DJANGO_SETTINGS_MODULE='tests.integration.settings' coverage run " return call("DJANGO_SETTINGS_MODULE='tests.settings' coverage run "
"./manage.py test tests.%s" % module) "./manage.py test tests.%s" % module)

View File

@ -384,7 +384,7 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
def is_submitter(self, person): def is_submitter(self, person):
"""Return True, if person is a submitter of this motion. Else: False.""" """Return True, if person is a submitter of this motion. Else: False."""
return self.submitter.filter(person=person).exists() return self.submitter.filter(person=person.pk).exists()
@property @property
def supporters(self): def supporters(self):
@ -400,7 +400,7 @@ class Motion(SlideMixin, AbsoluteUrlMixin, models.Model):
""" """
Return True, if person is a supporter of this motion. Else: False. Return True, if person is a supporter of this motion. Else: False.
""" """
return self.supporter.filter(person=person).exists() return self.supporter.filter(person=person.pk).exists()
def support(self, person): def support(self, person):
""" """

View File

View File

@ -0,0 +1,21 @@
from django.test.client import Client
from openslides.utils.test import TestCase
from openslides.motion.models import Motion
from openslides.config.api import config
class AnonymousRequests(TestCase):
"""
Tests requests from the anonymous user.
"""
def setUp(self):
self.client = Client()
config['system_enable_anonymous'] = True
def test_motion_detail(self):
Motion.objects.create(title='test_motion')
response = self.client.get('/motion/1/')
self.assertEqual(response.status_code, 200)