Add status filter into search
This commit is contained in:
parent
977b13b556
commit
fc7cac3184
2 changed files with 10 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ from .models import (
|
|||
GovernmentPlanSection,
|
||||
GovernmentPlanSectionsCMSPlugin,
|
||||
GovernmentPlanUpdatesCMSPlugin,
|
||||
PlanStatus,
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ class GovernmentPlansPlugin(CMSPluginBase):
|
|||
def render(self, context, instance, placeholder):
|
||||
context = super().render(context, instance, placeholder)
|
||||
context["plugin"] = instance
|
||||
context["status_list"] = PlanStatus.choices
|
||||
context["object_list"] = instance.get_plans(
|
||||
context["request"], published_only=False
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,13 @@
|
|||
{% load i18n %}
|
||||
<form method="get" action="{% url 'govplan:search' %}" class="ajaxified" data-container="#govplan-searchresult-{{ instance.id }}" data-modalcontainer="#govplan-searchmodal-{{ instance.id }}">
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" name="q" class="form-control" aria-label="{% translate 'Search all government plans…' %}" placeholder="{% translate 'Search all government plans…' %}">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" aria-label="{% translate 'Search query' %}" placeholder="{% translate 'Search query' %}">
|
||||
<select name="status" class="custom-select">
|
||||
<option value="">{% translate "Filter status" %}</option>
|
||||
{% for status, label in status_list %}
|
||||
<option value="{{ status }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-outline-secondary" type="submit">
|
||||
{% translate "Search" %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue