Skip to content
This repository has been archived by the owner on Jul 22, 2022. It is now read-only.

Commit

Permalink
Merge pull request #100 from makyo/assignment-99
Browse files Browse the repository at this point in the history
Fix assignment error, make form creation simpler
  • Loading branch information
makyo committed Dec 29, 2016
2 parents 3022f1e + 0085480 commit c34eeaf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
9 changes: 7 additions & 2 deletions administration/flag_views.py
Expand Up @@ -118,8 +118,13 @@ def create_flag(request):
object_id=obj.id,
))
if request.method == 'POST':
request.POST['content_type'] = ctype.id
form = FlagForm(request.POST)
form = FlagForm({
'subject': request.POST.get('subject'),
'flag_type': request.POST.get('flag_type'),
'body_raw': request.POST.get('body_raw'),
'content_type': ctype.id,
'object_id': obj.id,
})
if form.is_valid():
flag = form.save(commit=False)
flag.flagged_by = request.user
Expand Down
13 changes: 13 additions & 0 deletions administration/test_flag.py
Expand Up @@ -297,6 +297,19 @@ def test_creates_flag_without_owner(self):
}, follow=True)
self.assertContains(response, "User McUserface's flag")

def test_remove_immutable_assignment_99(self):
self.client.login(username='user',
password='user pass')
response = self.client.post(
reverse('administration:create_flag'), {
'content_type': 'usermgmt:profile',
'object_id': self.bar.id,
'flag_type': Flag.CONTENT,
'subject': 'it is bad',
'body_raw': 'i did not like it, *no sir*',
}, follow=True)
self.assertContains(response, "User McUserface's flag")


class ExistingFlagBaseTestCase(BaseFlagTestCase):
@classmethod
Expand Down

0 comments on commit c34eeaf

Please sign in to comment.