Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » [beginner] extra_context in generic views [RSS Feed]

#1 Jan. 20, 2011 06:01:05

John Y.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

[beginner] extra_context in generic views


http://docs.djangoproject.com/en/dev/topics/generic-views/#adding-extra-contextI am confused by the model scenario.

"For example, think of showing a list of all the books on each
publisher detail page. The object_detail generic view provides the
publisher to the context, but it seems there's no way to get
additional information in that template."
So, say below the detail of a publisher (first name, last name, books
published, phone, address, logo...etc), we might want to display a
list of other publisher.

"This would populate a {{ book_list }} variable in the template
context. This pattern can be used to pass any information down into
the template for the generic view. It's very handy."

So why do we create extra_context anyway?

A section above, the urlpatterns was
"urlpatterns = patterns('',
(r'^publishers/$', list_detail.object_list, publisher_info)
)"

I am confused. Can anyone explain what's going on if I have the
extra_context, and how do I exactly used that? Thanks.

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » [beginner] extra_context in generic views [RSS Feed]

Board footer

Moderator control

Enjoy the 21st of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support