Code

Opened 7 years ago

Closed 7 years ago

#4410 closed (duplicate)

Clarification needed with the generic views in Tutorial 4

Reported by: rBoa <mitch.hunt.007@…> Owned by: jacob
Component: Documentation Version: 0.96
Severity: Keywords: tutorial
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I am working my way through the tutorials and have a confusing section in Tutorial 4: Use generic views: Less code is better

I have read this section several times and I think it is missing some steps. The confusion starts right after we change the polls/urls.py file. I have the poll_list.html and poll_detail.html views working, but the results will not display.

I would be happy to help try fixing the section. Certainly, if I can be made to understand then it could be viewed as complete. ;)

Attachments (0)

Change History (4)

comment:1 Changed 7 years ago by mtredinnick

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

It's unclear if this is a request for help (in which case you should ask on the django-users mailing list) or just an offer to try and clarify some things. In the latter case, you don't need permission -- just attach a patch for us to review. We can't say yes or no without something to read. :-)

comment:2 Changed 7 years ago by Collin Grady <cgrady@…>

This may have something to do with the use of reverse() - I've helped several users in IRC get past this point, all with identical errors.

When the tutorial has you convert to generic views, it neglects to have you update reverse() - in addition, even if you did update it, it would reverse the wrong view since two of them use the same generic - it should be using url() for the results view so that it can be reversed directly.

In rBoa's case, it may be that he did see he had to update the reverse(), but it's reversing the wrong view now, so after a POST it just takes him right back to the page he was on.

comment:3 Changed 7 years ago by deerchao@…

Everything worked before I start to use generic view. After modifying polls/urls.py, I can't get any polls in /polls/, and any choices in /polls/1/(and yes, it's not a 404, but /polls/5/ gets a 404).
I'm using PostgreSql 8.2, django 0.96.

comment:4 Changed 7 years ago by SmileyChris

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

I'm going to close as a dupe of #4615 which clarifies what needs to be done after using the generic view.

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.