Friday, July 31, 2015

BaseListView's get_context_data is missing kwargs?

I created a class FilteredListView(BaseListView, FormMixin) so I can have a filter form in my list view.  The form submits filters via GET.  I have it working.  But there is a piece of the code that I feel ought to be handled by django.  In order to get the form into the context, I duplicated BaseListView.get() and changed the line

    context = self.get_context_data()

to 

    context = self.get_context_data(form=form)

BaseListView's get() accepts a kwargs but it is not used anywhere.  It seems to me that it should be passed to get_context_data() since it accepts a kwargs.  If it did, then I would only need to write a small get() method to instantiate (and optionally bind) the form, then call super with the appropriate kwargs argument to complete the get request processing.

Is there some reason why kwargs is not passed to get_context_data()?

Thanks


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0228628d-d979-47c1-a426-8d08922cabaa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment