diff --git a/django/views/generic/base.py b/django/views/generic/base.py
index d732af5..760b1fe 100644
a
|
b
|
class View(object):
|
44 | 44 | |
45 | 45 | def view(request, *args, **kwargs): |
46 | 46 | self = cls(**initkwargs) |
| 47 | if hasattr(self, 'get') and not hasattr(self, 'head'): |
| 48 | self.head = self.get |
47 | 49 | return self.dispatch(request, *args, **kwargs) |
48 | 50 | |
49 | 51 | # take name and docstring from class |
diff --git a/tests/regressiontests/generic_views/base.py b/tests/regressiontests/generic_views/base.py
index e20932b..d97a90b 100644
a
|
b
|
class ViewTest(unittest.TestCase):
|
101 | 101 | self.rf.get('/', REQUEST_METHOD='FAKE') |
102 | 102 | ).status_code, 405) |
103 | 103 | |
| 104 | def test_get_and_head(self): |
| 105 | """ |
| 106 | Test a view which supplies a GET method also responds correctly to HEAD |
| 107 | """ |
| 108 | self._assert_simple(SimpleView.as_view()(self.rf.get('/'))) |
| 109 | response = SimpleView.as_view()(self.rf.head('/')) |
| 110 | self.assertEqual(response.status_code, 200) |
| 111 | |
104 | 112 | def test_get_and_post(self): |
105 | 113 | """ |
106 | 114 | Test a view which only allows both GET and POST. |
… |
… |
class TemplateViewTest(TestCase):
|
167 | 175 | """ |
168 | 176 | self._assert_about(AboutTemplateView.as_view()(self.rf.get('/about/'))) |
169 | 177 | |
| 178 | def test_head(self): |
| 179 | """ |
| 180 | Test a TemplateView responds correctly to HEAD |
| 181 | """ |
| 182 | response = AboutTemplateView.as_view()(self.rf.head('/about/')) |
| 183 | self.assertEqual(response.status_code, 200) |
| 184 | |
170 | 185 | def test_get_template_attribute(self): |
171 | 186 | """ |
172 | 187 | Test a view that renders a template on GET with the template name as |