Merge pull request #689 from normanjaeckel/FixAccountWidget

Fixed #687
This commit is contained in:
Oskar Hahn 2013-05-31 06:43:28 -07:00
commit 20abfabb2c
2 changed files with 10 additions and 4 deletions

View File

@ -51,9 +51,9 @@ def get_personal_info_widget(request):
pass
else:
personal_info_context.update({
'submitted_motions': Motion.objects.filter(submitter=request.user),
'submitted_motions': Motion.objects.filter(submitter__person=request.user),
'config_motion_min_supporters': config['motion_min_supporters'],
'supported_motions': Motion.objects.filter(supporter=request.user)})
'supported_motions': Motion.objects.filter(supporter__person=request.user)})
try:
from openslides.assignment.models import Assignment
except ImportError:

View File

@ -78,20 +78,26 @@ class PersonalInfoWidget(TestCase):
motion = self.import_motion()
if motion:
motion_1 = motion.models.Motion.objects.create(title='My Motion Title pa8aeNohYai0ahge', text='My Motion Text')
motion_2 = motion.models.Motion.objects.create(title='My Motion Title quielohL7vah1weochai', text='My Motion Text')
submitter_1 = motion.models.MotionSubmitter.objects.create(motion=motion_1, person=self.user)
submitter_2 = motion.models.MotionSubmitter.objects.create(motion=motion_2, person=self.user)
response = self.client.get('/projector/dashboard/')
self.assertContains(response, 'I submitted the following motions:', status_code=200)
self.assertContains(response, 'My Motion Title pa8aeNohYai0ahge', status_code=200)
self.assertContains(response, 'My Motion Title quielohL7vah1weochai', status_code=200)
def test_supporter_list(self):
motion = self.import_motion()
if motion:
motion_1 = motion.models.Motion.objects.create(title='My Motion Title pa8aeNohYai0ahge', text='My Motion Text')
motion_1 = motion.models.Motion.objects.create(title='My Motion Title jahN9phaiThae5ooKubu', text='My Motion Text')
motion_2 = motion.models.Motion.objects.create(title='My Motion Title vech9ash8aeh9eej2Ga2', text='My Motion Text')
supporter_1 = motion.models.MotionSupporter.objects.create(motion=motion_1, person=self.user)
supporter_2 = motion.models.MotionSupporter.objects.create(motion=motion_2, person=self.user)
config['motion_min_supporters'] = 1
response = self.client.get('/projector/dashboard/')
self.assertContains(response, 'I support the following motions:', status_code=200)
self.assertContains(response, 'My Motion Title pa8aeNohYai0ahge', status_code=200)
self.assertContains(response, 'My Motion Title jahN9phaiThae5ooKubu', status_code=200)
self.assertContains(response, 'My Motion Title vech9ash8aeh9eej2Ga2', status_code=200)
def test_candidate_list(self):
assignment = self.import_assignment()