#20733: Minor code error in doc page for DetailView -------------------------------+------------------------ Reporter: ijl20@… | Owner: nobody Type: Bug | Status: new Component: Documentation | Version: 1.5 Severity: Normal | Keywords: DetailView Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------+------------------------ Re: [https://docs.djangoproject.com/en/dev/ref/class-based-views/generic- display/#django.views.generic.detail.DetailView]
Current (2013-July-11) docs give example myapp/article_detail.html: {{{ <h1>{{ object.headline }}</h1> <p>{{ object.content }}</p> <p>Reporter: {{ object.reporter }}</p> <p>Published: {{ object.pub_date|date }}</p> <p>Date: {{ object.now|date }}</p> }}} the last line should be {{{ <p>Date: {{ now|date }}</p> }}} Because views.py only adds 'now' to the context, not as a new attribute of the object being rendered, as below. Currently, object.now displays as 'blank'. {{{ def get_context_data(self, **kwargs): context = super(ArticleDetailView, self).get_context_data(**kwargs) context['now'] = timezone.now() return context }}} regards - Ian Lewis, Cambridge -- Ticket URL: <https://code.djangoproject.com/ticket/20733> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/058.6bd797a6074b7b143448fefb56ec1ac9%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.