Changes between Initial Version and Version 2 of Ticket #16744


Ignore:
Timestamp:
Sep 2, 2011, 4:09:15 AM (13 years ago)
Author:
Jannis Leidel
Comment:

Corrected get_context_dict to get_context_data.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #16744

    • Property Triage Stage UnreviewedAccepted
  • Ticket #16744 – Description

    initial v2  
    1 Summary: `your_cbv_object.get_context_dict()` should include `{'view': self}`.
     1Summary: `your_cbv_object.get_context_data()` should include `{'view': self}`.
    22
    33Now that django has class based views, I was surprised that I don't get the view object in my template's context. And that I still have to hand-craft my context dictionary.
     
    55What would be handier than setting attributes or adding methods to the view class and accessing them with `{{ view.my_attribute }}` and ``{{ view.my_method }}`? Without having to do the double work of adding them by hand to the context dictionary? An additional benefit: you encourage to do even more in python and even less in the template by making it easy to add helper methods in your view.
    66
    7 The solution could as simple as adding `{'view': self}` in the three or four spots in django itself where a `.get_context_dict()` is defined.
     7The solution could as simple as adding `{'view': self}` in the three or four spots in django itself where a `.get_context_data()` is defined.
Back to Top