Thanks for the reply Melvyn - I'm slowly getting there!

So, I now understand how to insert the unique object reference. After 
creating card.html, and defining card in views, my list element URL is:

{% for card in cards.all %}
    <li class="card"><a href="{% url 'card' %}/{{ card.id }}">{{ card.title 
}}</a> </li>
{% endfor %}

And if I click on the second card object in the list, it opens 
up http://127.0.0.1:8000/scrumbuddy/card/2 - hooray, progress!

Ok, so now I understand what *card.id* is and I use this to references the 
model object instances. So, I presume I need to use that ID to render the 
details of each card into the body block of card.html.

Would that require editing the card view? All I have at the moment is:

def card(request):
    return render(request, 'scrumbuddy/card.html')


So somewhere in here I'd create a reference to *card.id, *and perhaps pass 
the id within a context variable?

Thanks again guys, it feels good to be making some progress! Really 
appreciate your help.

On Wednesday, 14 February 2018 16:07:32 UTC, Melvyn Sopacua wrote:
>
> On woensdag 14 februari 2018 16:14:40 CET Lylio wrote: 
>
> > I'd like to click on one of the items in the list and open up a new page 
> > showing all the database details for that particular list item (title, 
> > description, time of creation, etc). Roughly, would I change the list 
> items 
> > into links: 
> > 
> > <ul> 
> >        {% for card in cards.all %} 
> >            <li class="card"><a href='card.html/get(this_object_id)>{{ 
> > card.title }}</a></li> 
> > 
> >        {% endfor %} 
> > </ul> 
> > 
> > 
> > Then there would be a new view defined, something like 
> > 
> > def card(request): 
> >     object = get(this_object_id) 
> >     context = {'cards': object} 
> >     return render(request, 'scrumbuddy/card.html', context) 
> > 
>
> > On Tuesday, 13 February 2018 14:18:25 UTC, Gonzalo Delgado wrote: 
>
> > > I can assure you using Django for a project like yours is *very* 
> > > straightforward. 
> > > When in doubt, revisit the Django tutorial. This part is a good one 
> for 
> > > where you're at: 
> https://docs.djangoproject.com/en/2.0/intro/tutorial03/ 
>
>
> You did not follow this advice, or you would already know how to tie the 
> url 
> to the primary key of a model instance. It is spelled out there in detail. 
> -- 
> Melvyn Sopacua 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/b3d9d3df-b5d4-4ecb-a5bc-ecd4207c8754%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to