diff --git a/django/contrib/admindocs/views.py b/django/contrib/admindocs/views.py
index ef9b781..eb3eacc 100644
a
|
b
|
class ModelDetailView(BaseAdminDocsView):
|
262 | 262 | 'data_type': 'Integer', |
263 | 263 | 'verbose': utils.parse_rst(_("number of %s") % verbose, 'model', _('model:') + opts.model_name), |
264 | 264 | }) |
| 265 | |
| 266 | verbose = utils.parse_rst(utils.trim_docstring(model.__doc__), 'model', _('model:') + opts.model_name) |
265 | 267 | kwargs.update({ |
266 | 268 | 'name': '%s.%s' % (opts.app_label, opts.object_name), |
267 | 269 | # Translators: %s is an object type name |
268 | 270 | 'summary': _("Attributes on %s objects") % opts.object_name, |
269 | | 'description': model.__doc__, |
| 271 | 'description': verbose, |
270 | 272 | 'fields': fields, |
271 | 273 | }) |
272 | 274 | return super(ModelDetailView, self).get_context_data(**kwargs) |
diff --git a/tests/admin_docs/models.py b/tests/admin_docs/models.py
index 9b8f388..f07cde4 100644
a
|
b
|
class Family(models.Model):
|
18 | 18 | |
19 | 19 | |
20 | 20 | class Person(models.Model): |
| 21 | """ |
| 22 | Similar as :model:`auth.User`. |
| 23 | """ |
21 | 24 | first_name = models.CharField(max_length=200, help_text="The person's first name") |
22 | 25 | last_name = models.CharField(max_length=200, help_text="The person's last name") |
23 | 26 | company = models.ForeignKey(Company, help_text="place of work") |
diff --git a/tests/admin_docs/tests.py b/tests/admin_docs/tests.py
index 6eecb6a..75e905b 100644
a
|
b
|
class TestModelDetailView(TestCase):
|
236 | 236 | |
237 | 237 | def test_descriptions_render_correctly(self): |
238 | 238 | """ |
239 | | The ``description`` field should render correctly for each type of field |
| 239 | The ``description`` field should render correctly for the model itself |
| 240 | and for each type of field. |
240 | 241 | """ |
| 242 | link = '<a class="reference external" href="/admindocs/models/%s/">%s</a>' |
| 243 | markup = '<p>the related %s object</p>' |
| 244 | |
| 245 | # model docstring |
| 246 | auth_markup = link % ("auth.user", "auth.User") |
| 247 | self.assertContains(self.response, auth_markup) |
| 248 | |
241 | 249 | # help text in fields |
242 | 250 | self.assertContains(self.response, "<td>first name - The person's first name</td>") |
243 | 251 | self.assertContains(self.response, "<td>last name - The person's last name</td>") |
… |
… |
class TestModelDetailView(TestCase):
|
245 | 253 | # method docstrings |
246 | 254 | self.assertContains(self.response, "<p>Get the full name of the person</p>") |
247 | 255 | |
248 | | link = '<a class="reference external" href="/admindocs/models/%s/">%s</a>' |
249 | | markup = '<p>the related %s object</p>' |
250 | 256 | company_markup = markup % (link % ("admin_docs.company", "admin_docs.Company")) |
251 | 257 | |
252 | 258 | # foreign keys |