title: How to display contents based on their category on button click in Same page in Django?
body: <p>I am working on a portfolio project. where I have to categorize the projects based on their Categories. I have given buttons for each categories and I have to display each contents of individual categories on Button Clicks below them.
  Eg. I have 2 projects in Design category. When I click Design I should get these two projects below the button.</p>
  
  <p>I tried filtering of contents and successfully displayed them in other page but unable to display them in the same page.</p>
  
  <p>Here is my Code:
  <strong>Models.py</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>class PortfolioCategory(models.Model):
      projectCategory = models.CharField(max_length=200)
      projectSummary = models.CharField(max_length=300)
      projectLink = models.CharField(max_length=200)
  
      class Meta:
          verbose_name_plural = "categories"
  
      def __str__(self):
          return self.projectCategory
  
  
  class Portfolio(models.Model):
      projectName = models.CharField(max_length=250)
      projectLink = models.CharField(max_length=50, default="")
      projectImage = models.ImageField(upload_to="img/Portfolio/")
      projectContent = models.TextField(default="")
      projectCategory = models.ForeignKey(
          PortfolioCategory, verbose_name="Category", on_delete=models.CASCADE)
  
      def __str__(self):
          return self.projectName
  </code></pre>
  
  <p><strong>Views.Py</strong></p>
  
  <pre class="lang-py prettyprint-override"><code>def projectLink(request, projectLink):
      category = [c.projectLink for c in PortfolioCategory.objects.all()]
      if projectLink in category:
          categoryItems = Portfolio.objects.filter(
              projectCategory__projectLink=projectLink)
          myProjects = categoryItems.all()
          return render(
              request,
              "main/home.html#projectLink",
              {
                  "projects": myProjects,
                  "navbar": navbar,
              }
          )
      projectContent = Portfolio.objects.get(projectLink=projectLink)
      return render(
          request,
          "main/projectItem.html",
          {
              "project": projectContent,
              "navbar": navbar,
          }
      )
  
  
  def homepage(request):
      return render(
          request=request,
          template_name="main/home.html",
          context={
              "portfolios": Portfolio.objects.all,
              "categories": PortfolioCategory.objects.all,
              "navbar": navbar,
              "socialLinks": socialIcons,
              "skillset": skills,
          })
  </code></pre>
  
  <p><strong>home.html</strong></p>
  
  <pre><code>&lt;ul class="nav nav-tabs justify-content-center"&gt;
              {% for cat in categories  %}
  
              &lt;li&gt;&lt;a data-toggle="tab" href="#{{cat.projectLink}}"&gt;{{cat.projectCategory}}&lt;/a&gt;&lt;/li&gt;
  
              {% endfor %}
          &lt;/ul&gt;
          &lt;div class="tab-content"&gt;
              {% for cat in categories %}
              &lt;div id="{{cat.projectLink}}" class="tab-pane fadeIn"&gt;
                  {{cat.projectCategory}}
                   //Projects Detail Here
  
              &lt;/div&gt;
              {% endfor %}
          &lt;/div&gt;
  </code></pre>
  
  <p>I have to show the cards of each Projects on button clicks.</p>