Beispiel #1
0
 def get_context_data(self, **kwargs):
     context = super(SpeakerTalkDetails, self).get_context_data(**kwargs)
     context["comments"] = (context["talk"].talkcomment_set.filter(
         is_visible=True).all())
     context["comment_form"] = TalkSpeakerCommentForm(
         instance=context["talk"])
     return context
Beispiel #2
0
 def test_init_creates_layout(self):
     form = TalkSpeakerCommentForm(instance=mock.MagicMock(pk=1))
     self.assertIsInstance(form.helper.layout, Layout)
     layout_fields = [
         name for [_, name] in form.helper.layout.get_field_names()
     ]
     self.assertListEqual(['comment'], layout_fields)
     self.assertEqual(len(form.helper.layout.get_layout_objects(Submit)), 1)
Beispiel #3
0
 def test_init_creates_form_helper(self):
     form = TalkSpeakerCommentForm(instance=mock.MagicMock(pk=1))
     self.assertIsInstance(form.helper, DevDayFormHelper)
     self.assertEqual(form.fields['comment'].widget.attrs['rows'], 2)
     self.assertEqual(form.helper.form_action,
                      '/session/speaker/talks/1/comment/')
Beispiel #4
0
 def test_fields(self):
     form = TalkSpeakerCommentForm(instance=mock.MagicMock(pk=1))
     self.assertListEqual(['comment'], list(form.fields))
Beispiel #5
0
 def test_init_creates_form_helper(self):
     form = TalkSpeakerCommentForm(instance=mock.MagicMock(pk=1))
     self.assertIsInstance(form.helper, FormHelper)
     self.assertEqual(form.helper.form_action,
                      "/session/speaker/talks/1/comment/")