Opened 15 years ago
Closed 15 years ago
#11187 closed (wontfix)
Documentation: Explicit is better than implicit.
Reported by: | arbitraryuser | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 1.0 |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
The short version:
I think it might make sense to modify the documentation at http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method to say >>> f = ArticleForm(data=request.POST)
rather than just >>> f = ArticleForm(request.POST)
as users will run into 'non-keyword arg after keyword arg' issues when using more advanced incantations of ModelForm.
The long version:
I ran into a problem with http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#the-save-method because I was passing my form def an additional varible with which to limit the options of drop down box. This works fine until you are also doing a ModelForm based update and need to pass data, your instance *and* an object that you want to filter with. I had to in the source to see what the arg's name actually was.
PS. Loving Django so f-ing much right now... :)
Passing it as a positional argument is a completely valid way to instantiate a form, this is not a case of explicit vs. implicit.