add category to frontend
This commit is contained in:
parent
fb438c26b1
commit
26cffd4420
2 changed files with 14 additions and 3 deletions
|
@ -25,7 +25,7 @@
|
|||
<!-- </div> -->
|
||||
</div>
|
||||
<div class="col">
|
||||
<form class="d-flex" role="search" action="" method="GET">
|
||||
<form class="d-flex" role="search" action="" method="GET" novalidate>
|
||||
<div class="container overflow-hidden ">
|
||||
<div class="row gy-5">
|
||||
<div class="col position-relative">
|
||||
|
@ -38,8 +38,18 @@
|
|||
placeholder="{% trans "Search" %}"
|
||||
required=""
|
||||
id="id_search">
|
||||
<div class="col position-relative mt-2">
|
||||
<button class="btn bg-primary fw-bold position-absolute top-50 end-0" type="submit">{% trans "Filter" %}</button>
|
||||
<div class="col">
|
||||
<div class="row mt-2">
|
||||
<div class="col col-xxl">
|
||||
<select class="form-select" aria-label="Large select example" name="category">
|
||||
<option value="" disabled selected>{% trans "select category" %}</option>
|
||||
{% for category in categories %}<option value="{{ category.slug }}">{{ category.name }}</option>{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-md-auto">
|
||||
<button class="btn bg-primary fw-bold" type="submit">{% trans "Filter" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -52,4 +52,5 @@ class Browse(ListView):
|
|||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context['featured_posts'] = BlogPost.objects.filter(featured=True)
|
||||
context['categories'] = Category.objects.all()
|
||||
return context
|
||||
|
|
Loading…
Add table
Reference in a new issue