<ul>
{% for card in cards.all %}
<li class="card">{{ card.title }} </li>
{% endfor %}
</ul>
<ul>
{% for card in cards.all %}
<li class="card"><a href='card.html/get(this_object_id)>{{ card.title }}</a></li>
{% endfor %}
</ul>
def card(request):
object = get(this_object_id)
context = {'cards': object}
return render(request, 'scrumbuddy/card.html', context)
You’ll want to use card.get_absolute_url.
See https://docs.djangoproject.com/en/2.0/ref/models/instances/#get-absolute-url
In your get_absolute_url, you should probably use the reverse method to use the name of a URL rather than hard-coding it in the method. That’s the second example in that section.
--
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...@googlegroups.com.
To post to this group, send email to
django...@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/eee70b8a-daff-453f-bb46-b4c2769d33e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{% for card in cards.all %}
<li class="card"><a href="{% url 'card' %}/{{ card.id }}">{{ card.title }}</a> </li>
{% endfor %}
def card(request):
return render(request, 'scrumbuddy/card.html')
{% for card in cards.all %}<li class="card"><a href="{% url 'card' %}/{{ card.id }}">{{ card.title }}</a> </li>
{% endfor %}
def card(request):
return render(request, 'scrumbuddy/card.html')