Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -701,6 +701,7 @@ answer newbie questions, and generally made Django that much better: Zach Thompson <zthompson47@gmail.com> Zain Memon Zak Johnson <zakj@nox.cx> Žan Anderle <zan.anderle@gmail.com> Zbigniew Siciarz <zbigniew@siciarz.net> zegor Zlatko Mašek <zlatko.masek@gmail.com> Loading django/contrib/admindocs/templates/admin_doc/model_detail.html +3 −4 Original line number Diff line number Diff line Loading @@ -22,11 +22,10 @@ {% block content %} <div id="content-main"> <h1>{{ summary }}</h1> <h1>{{ name }}</h1> <h2 class="subhead">{{ summary }}</h2> {% if description %} <p>{% filter linebreaksbr %}{% trans description %}{% endfilter %}</p> {% endif %} {{ description }} <div class="module"> <table class="model"> Loading django/contrib/admindocs/views.py +10 −4 Original line number Diff line number Diff line Loading @@ -178,18 +178,25 @@ class ModelDetailView(BaseAdminDocsView): template_name = 'admin_doc/model_detail.html' def get_context_data(self, **kwargs): model_name = self.kwargs['model_name'] # Get the model class. try: app_config = apps.get_app_config(self.kwargs['app_label']) except LookupError: raise Http404(_("App %(app_label)r not found") % self.kwargs) try: model = app_config.get_model(self.kwargs['model_name']) model = app_config.get_model(model_name) except LookupError: raise Http404(_("Model %(model_name)r not found in app %(app_label)r") % self.kwargs) opts = model._meta title, body, metadata = utils.parse_docstring(model.__doc__) if title: title = utils.parse_rst(title, 'model', _('model:') + model_name) if body: body = utils.parse_rst(body, 'model', _('model:') + model_name) # Gather fields/field descriptions. fields = [] for field in opts.fields: Loading Loading @@ -271,9 +278,8 @@ class ModelDetailView(BaseAdminDocsView): }) kwargs.update({ 'name': '%s.%s' % (opts.app_label, opts.object_name), # Translators: %s is an object type name 'summary': _("Attributes on %s objects") % opts.object_name, 'description': model.__doc__, 'summary': title, 'description': body, 'fields': fields, }) return super(ModelDetailView, self).get_context_data(**kwargs) Loading docs/releases/1.8.txt +5 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,11 @@ Minor features <django.contrib.admin.ModelAdmin.show_full_result_count>` to control whether or not the full count of objects should be displayed on a filtered admin page. :mod:`django.contrib.admindocs` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * reStructuredText is now parsed in model docstrings. :mod:`django.contrib.auth` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Loading tests/admin_docs/models.py +12 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,18 @@ class Family(models.Model): class Person(models.Model): """ Stores information about a person, related to :model:`myapp.Company`. **Notes** Use ``save_changes()`` when saving this object. ``company`` Field storing :model:`myapp.Company` where the person works. (DESCRIPTION) """ first_name = models.CharField(max_length=200, help_text="The person's first name") last_name = models.CharField(max_length=200, help_text="The person's last name") company = models.ForeignKey(Company, help_text="place of work") Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -701,6 +701,7 @@ answer newbie questions, and generally made Django that much better: Zach Thompson <zthompson47@gmail.com> Zain Memon Zak Johnson <zakj@nox.cx> Žan Anderle <zan.anderle@gmail.com> Zbigniew Siciarz <zbigniew@siciarz.net> zegor Zlatko Mašek <zlatko.masek@gmail.com> Loading
django/contrib/admindocs/templates/admin_doc/model_detail.html +3 −4 Original line number Diff line number Diff line Loading @@ -22,11 +22,10 @@ {% block content %} <div id="content-main"> <h1>{{ summary }}</h1> <h1>{{ name }}</h1> <h2 class="subhead">{{ summary }}</h2> {% if description %} <p>{% filter linebreaksbr %}{% trans description %}{% endfilter %}</p> {% endif %} {{ description }} <div class="module"> <table class="model"> Loading
django/contrib/admindocs/views.py +10 −4 Original line number Diff line number Diff line Loading @@ -178,18 +178,25 @@ class ModelDetailView(BaseAdminDocsView): template_name = 'admin_doc/model_detail.html' def get_context_data(self, **kwargs): model_name = self.kwargs['model_name'] # Get the model class. try: app_config = apps.get_app_config(self.kwargs['app_label']) except LookupError: raise Http404(_("App %(app_label)r not found") % self.kwargs) try: model = app_config.get_model(self.kwargs['model_name']) model = app_config.get_model(model_name) except LookupError: raise Http404(_("Model %(model_name)r not found in app %(app_label)r") % self.kwargs) opts = model._meta title, body, metadata = utils.parse_docstring(model.__doc__) if title: title = utils.parse_rst(title, 'model', _('model:') + model_name) if body: body = utils.parse_rst(body, 'model', _('model:') + model_name) # Gather fields/field descriptions. fields = [] for field in opts.fields: Loading Loading @@ -271,9 +278,8 @@ class ModelDetailView(BaseAdminDocsView): }) kwargs.update({ 'name': '%s.%s' % (opts.app_label, opts.object_name), # Translators: %s is an object type name 'summary': _("Attributes on %s objects") % opts.object_name, 'description': model.__doc__, 'summary': title, 'description': body, 'fields': fields, }) return super(ModelDetailView, self).get_context_data(**kwargs) Loading
docs/releases/1.8.txt +5 −0 Original line number Diff line number Diff line Loading @@ -76,6 +76,11 @@ Minor features <django.contrib.admin.ModelAdmin.show_full_result_count>` to control whether or not the full count of objects should be displayed on a filtered admin page. :mod:`django.contrib.admindocs` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ * reStructuredText is now parsed in model docstrings. :mod:`django.contrib.auth` ^^^^^^^^^^^^^^^^^^^^^^^^^^ Loading
tests/admin_docs/models.py +12 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,18 @@ class Family(models.Model): class Person(models.Model): """ Stores information about a person, related to :model:`myapp.Company`. **Notes** Use ``save_changes()`` when saving this object. ``company`` Field storing :model:`myapp.Company` where the person works. (DESCRIPTION) """ first_name = models.CharField(max_length=200, help_text="The person's first name") last_name = models.CharField(max_length=200, help_text="The person's last name") company = models.ForeignKey(Company, help_text="place of work") Loading