Opened 4 years ago

Closed 4 years ago

#16589 closed Bug (worksforme)

ModelForm documentation error (saving unbound form)

Reported by: toby@… Owned by: nobody
Component: Documentation Version: 1.3
Severity: Normal 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 ModelForm documentation has the following snippet:

# Create a form to edit an existing Article. 
>>> a = Article.objects.get(pk=1) 
>>> f = ArticleForm(instance=a) 
>>> f.save() 

Since the form is unbound, that f.save() is going to fail. Maybe that should be:

print f

Change History (2)

comment:1 Changed 4 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Since ArticleForm receives an instance argument, it is bound, isn't it? Did I miss something obvious?

comment:2 Changed 4 years ago by aaugustin

  • Resolution set to worksforme
  • Status changed from new to closed

No reply => closing the ticket.

Note: See TracTickets for help on using tickets.
Back to Top