'Tests the default delete action defined as a ModelAdmin method in the
case where some related objects are protected from deletion.'

def test_model_admin_default_delete_action_protected(self):

    q1 = Question.objects.create(question='Why?')
    a1 = Answer.objects.create(question=q1, answer='Because.')
    a2 = Answer.objects.create(question=q1, answer='Yes.')
    q2 = Question.objects.create(question='Wherefore?')
    action_data = {ACTION_CHECKBOX_NAME: [q1.pk, q2.pk], 'action': 'delete_selected', 'index': 0}
    response = self.client.post('/test_admin/admin/admin_views/question/', action_data)
    self.assertContains(response, 'would    require    deleting    the    following    protected    related    objects')
    self.assertContains(response, ('<li>Answer:    <a    href="/test_admin/admin/admin_views/answer/%s/">Because.</a></li>' % a1.pk))
    self.assertContains(response, ('<li>Answer:    <a    href="/test_admin/admin/admin_views/answer/%s/">Yes.</a></li>' % a2.pk))
