Code

Opened 2 years ago

Closed 2 years ago

#17537 closed Uncategorized (worksforme)

Writing your first Django app, part 4 - Generic Views - Update to index.html needed

Reported by: canice_lambe@… 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

I could only get the Generic Views to work after I gave the detail view a name 'poll_details' in the urlpatterns and updated index.html to have line:

<li><a href="{% url poll_details pk=poll.id %}">{{ poll.id }}. {{ poll.question }}</a></li>

Attachments (0)

Change History (1)

comment:1 Changed 2 years ago by nate_b

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

I just built up this tutorial, and it runs just fine leaving the link in index.html as so:

 <a href="/polls/{{ poll.id }}/">{{ poll.question }}</a> 

As the url reversal template tag isn't even introduced in the "first Django app" tut, I think it may be better to leave as is. The extra step you took is, as they say, an exercise for the reader.

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.