Code

Opened 7 years ago

Closed 7 years ago

#4572 closed (fixed)

How to use form_for_instance could benefit from more explanation

Reported by: toddobryan@… Owned by: jacob
Component: Documentation Version: master
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I've attached a patch.

Attachments (3)

form_for_instance_patch.txt (1.3 KB) - added by toddobryan@… 7 years ago.
patch including an extra paragraph of explanation for form_for_instance
form_for_instance_patch.2.txt (1.7 KB) - added by toddobryan@… 7 years ago.
patch to clarify how to use form_for_instance
form_for_instance.patch (1.4 KB) - added by anonymous 7 years ago.

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by toddobryan@…

patch including an extra paragraph of explanation for form_for_instance

comment:1 Changed 7 years ago by SmileyChris

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement set
  • Triage Stage changed from Unreviewed to Accepted

Your description doesn't match the code, you actually create a new form class using form_for_instance and instantiate this in GET and POST.

comment:2 Changed 7 years ago by toddobryan@…

You are absolutely correct. I'll fix this as soon as I can. Unfortunately, I'm at a hotel with not very reliable wireless service and can't access the SVN repository, so it will probably be Monday afternoon before I can get to it.

Changed 7 years ago by toddobryan@…

patch to clarify how to use form_for_instance

comment:3 Changed 7 years ago by toddobryan@…

OK. The docs have been updated to match the code.

comment:4 Changed 7 years ago by SmileyChris

if request.method == 'POST': is actually the proper way to check for a POST call, the ticket is a bit messy adding in some ignores, and get_object_or_404 isn't a function of the Manager - it's a shortcut.

Maybe you could submit as a .diff or .patch too, that might fix trac not displaying the patch correctly.

Thanks :)

Changed 7 years ago by anonymous

comment:5 Changed 7 years ago by toddobryan@…

OK...

  • request.method == 'POST'...check
  • get_object_or_404() function fixed (big whoops on that)...check
  • submitted as .patch, which does fix the display...check

I don't understand what you mean by "the ticket is a bit messy adding in some ignores," but will be happy to de-messify if you can clarify.

I don't know why you're being so picky about all these issues. If everything is perfect before it gets checked in, there won't be anything for anyone else to fix later. :-) Seriously, though, thanks for looking.

comment:6 Changed 7 years ago by SmileyChris

  • Patch needs improvement unset
  • Triage Stage changed from Accepted to Ready for checkin

Don't worry, Adrian will still find lots to fix with it. I just go after the glaring mistakes ;)

comment:7 Changed 7 years ago by mtredinnick

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

(In [5988]) Fixed #4572 -- Added an example of form_for_instance usage in a full-fledged view. Based on a patch from toddobryan@….

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.