Thanks for the reply Gonzalo, I really appreciate the feedback.

So, conceptually I understand how the remaining pieces of this app fit 
together - but could I ask for just a little more of your help as I'm 
struggling with coding the details of what's needed.

Let's start basic - I've got some 'cards' in my database and on one of the 
web pages the title of the card is presented in a list (with some CSS 
styling to present the list item as a rectangle):

       {% for card in cards.all %}
           <li class="card">{{ card.title }}  </li>
       {% endfor %}

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:

       {% for card in cards.all %}
           <li class="card"><a href='card.html/get(this_object_id)>{{ 
card.title }}</a></li>

       {% endfor %}

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)

I know this code is incorrect, but is it roughly how I should proceed? 
Connecting the list item URL to the card view which I don't really 
understand how to do.

Many thanks


On Tuesday, 13 February 2018 14:18:25 UTC, Gonzalo Delgado wrote:
> Hi Lylio, 
> On 12/2/18 16:20, Lylio wrote: 
> > 1. To click on a card so it opens up and displays the details, am I 
> right 
> > to say I should create a card.html file in the templates folder for 
> this? 
> It isn't necessary, but it is a good idea 
> What you need is to create a view that renders such template. 
> I suggest you write your own view function that does that, but what 
> you'd usually do is just use a generic view and either pass it the 
> template you want to use, or name the template in a way the generic view 
> will find it on its own. 
> See: 
> > 2. I'm confused about how Django keeps track of the cards in my app - I 
> > presume each card object has an ID in the database and I'd need this 
> ID in 
> > order to retrieve the card's details when it's clicked - but I'm 
> unsure of 
> > how to link the two. In the two pictures above, say someone clicked on 
> the 
> > 'class progression' card on the left... I'd like a new page to open up 
> that 
> > display the details for that card and allows the user to edit the info 
> or 
> > completely delete the card. 
> Yes, in general, every Django model instance has an id (unless you 
> specifically tell it not to), and you can use it to create urls for the 
> detail view I mentioned earlier. This is a good start, but you'll later 
> want to add a SlugField to your Card model, and use that instead of the 
> id so urls look nicer. 
> > I'm maybe asking a bit much here - but I'm unsure of how complex these 
> > requirements are. It feels like it should be *fairly *straightforward. 
> Any 
> > thoughts or advice would be greatly appreciated. 
> 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: 
> -- 
> Gonzalo Delgado 

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 post to this group, send email to
Visit this group at
To view this discussion on the web visit
For more options, visit

Reply via email to