Passing id in url to get object info

I'm like 3 days trying to find the solution to this problem. I have a dashboard with items, every single item is called board. The dashboard is populated with object (board) that i've stored in my local db. Data like the name of this board is shown in the html page called dashboard.

What i want to do is, when i click on the link named 'Scopri di più' , to be redirected in the board.html populated with the clicked item data.

At the time i'm only getting the error 'NoReverseMatch'.

What am i doing wrong?


{% extends "base.html" %}
{% block content %}

    <a href="/new_board/" class="text-dark">Aggiungi Board</a>
    <div class="row mt-5">
        {% for bn in user_board_list %}
            <div class="col ml-4">

                <div class="card">
                    <div class="card-body">
                        <h5 class="card-title"> {{ bn.board_name}} </h5>
                        <p class="card-text">Breve descrizione della board</p>
                                <a href="{% url 'board_view' %}">Scopri di più</a>
        {% endfor %}

{% endblock %}

class Board_dets_view(DetailView):
    template_name = "board.html"

    def board_view(request, pk):
        #board = get_object_or_404(request,pk=pk)
        board = Board.objects.get(pk=pk)
        context = {'title': title, 'board': board}
        return render(request, 'board.html', context)

class Board(models.Model):
    board_name = models.CharField(unique=True, max_length = 200, verbose_name='board_name',
                                  error_messages= {'unique': 'Nome della board già utilizzato. Per favore inseriscine un altro.'})
    creation_date = models.DateTimeField('data di creazione', auto_now_add=True)
    objects = models.Manager()
    id_user = models.ManyToManyField(User, related_name='user_board', verbose_name='id utente', through='Board_id_user')

    def __repr__(self):

    path(r'board/<int:pk>', Board_dets_view.as_view() , name='board_view')

Read more here:

Content Attribution

This content was originally published by blackJarvis at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: