Hi, I was trying my project on django 1.5 alpha and a change on 
TemplateViews made some code break. 
The `get` method changed how `get_context_data` is called from (**kwargs)to 
(params=kwargs). Link: 
https://github.com/django/django/blob/master/django/views/generic/base.py

I traced the change and found a ticket saying the TemplateView could not be 
used with FormView because the get_context_data is in a different layout. 
Ticket: https://code.djangoproject.com/ticket/16074

I don't know how popular are classed based views among other django 
developers, but I only use them. So, this change could be added in the 
release notes to warn people about breaking some code.
For me, I had the habit of writing:

With e.g. this url:   url(r'^ref/(?P<id>\d+?)/?$', views.ref.Show.as_view())

    def get_context_data(self, id, **kw):
        pass #do something with id

Now, the only way I find to keep the code compatible with both 1.4 and 1.5 
is doing:

    def get_context_data(self, **kw):
        id = kw.get('params', kw)['id']

which is just a little bit more code but could crash in django 1.4 if 
somehow there's a "params" argument

Could this be avoided?

Thanks,
Bernardo

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-developers/-/lkFGZ_YVeJQJ.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to