Hi everyone,
I've unfortunately hit another brick wall with my Django app. I have my
list of card objects, and when one of them is clicked, I'd like a new page
to open that contains the details for the card that was clicked. I found
out how to create a URL using {{ card.id }}:
{% for card in cards.all %}
<li class="card"><a href="{% url 'card' %}/{{ card.id }}">{{ card.title
}}</a> </li>
{% endfor %}
and in views the card def is simply:
def card(request):
return render(request, 'scrumbuddy/card.html')
So, for example if I click on the third card object in the list, the URL
returned is http://127.0.0.1:8000/scrumbuddy/card/3
But I'm unsure of how to populate
the http://127.0.0.1:8000/scrumbuddy/card/3 page with the database info for
card 3. Hopefully this screenshot can demonstrate:
<https://lh3.googleusercontent.com/-q5WYRLQ3HvM/Won3Gc2HVjI/AAAAAAAACnY/HYlU2OAHJOQO17ySlg9R11yxpC_Cd_3NACLcBGAs/s1600/SB.jpg>
On Monday, 12 February 2018 21:00:53 UTC, Lylio wrote:
>
> Hi everyone,
>
> I'm new to Django and currently working on a very simple app. It's
> basically a note app, a bit like a Trello board but aimed at creating
> user-story cards for software development teams (code at
> https://github.com/Lylio/scrumbuddy_project).
>
> I made a mock-up in Photoshop of how it's supposed to look:
>
> <http://i65.tinypic.com/2lv1lrk.png> <http://i64.tinypic.com/6hrthz.png>
>
>
> I've got some basic functionality up and running - users can register and
> create a user-story card. When a new card is created, a title, description,
> time estimation are inputted. Cards are just displayed as list items in
> columns. I'm trying to add a button to the cards so that when it's clicked,
> the details of the card open up in a new and a user can edit the card info
> or delete it.
>
> A couple of noob questions:
>
> 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?
>
> 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.
>
> 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.
>
> Thanks for your time
>
--
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 [email protected].
To post to this group, send email to [email protected].
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/5e39f472-d372-42b8-a5fe-ac1c3a0d75ea%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.