I want to Pass the text inside anchor tag when clicked on that tag and to show the same text on the directed page

This is my discover.html file

<form action="POST">
    <div class="swipe-area">
      <div class="swiper-container mySwiper">
        <div class="swiper-wrapper">
          {% for topic in topics %}
            <div class="swiper-slide">
              <a href="{% url 'content' %}" style="color: white; text-decoration: none;">
                <h1 name="headings" data-tooltip="{{ topic.description }}" data-tooltip-location="bottom">
                  {{ topic.heading }}
                </h1>
              </a>
            </div>
          {% endfor %}
        </div>
        <div class="swiper-button-next"></div>
        <div class="swiper-button-prev"></div>
      </div>
      <!-- <div class="swiper-button-next"></div>
      <div class="swiper-button-prev"></div> -->
    </div>
  </form>

I want to pass the value of h1 tag that is {{ topic.heading }} when clicked on that link to the page that link takes me.

              <a href="{% url 'content' %}" style="color: white; text-decoration: none;">
                <h1 name="headings" data-tooltip="{{ topic.description }}" data-tooltip-location="bottom">
                  {{ topic.heading }}
                </h1>
              </a>

Below is my views.py file

def content(request):
    heading = request.GET['headings']
    content = Search.objects.all().filter(title__contains = heading)
    context = {'content': content}
    return render(request, 'search/content.html', context)

So I want that variable value in my content.html page. Please tell me how to tackle this problem, I have been stuck here for 2 weeks.

Answer

You should add the heading in the link href.

      <a href="{% url 'content' %}?heading={{topic.heading}}" style="color: white; text-decoration: none;">
        <h1 name="headings" data-tooltip="{{ topic.description }}" data-tooltip-location="bottom">
          {{ topic.heading }}
        </h1>
      </a>

This will output something like <a href="http://localhost:8000/content?heading=foobar"></a>, then when user clicks on this link, the heading parameter will be added in request.GET.

You need to modify your view accordingly heading = request.GET['heading'].