Revert "add filter to new keywords page"
This reverts commit c6dd55df4e
.
This commit is contained in:
@ -66,14 +66,6 @@ class IngredientFilter(django_filters.FilterSet):
|
||||
fields = ['name']
|
||||
|
||||
|
||||
class KeywordFilter(django_filters.FilterSet):
|
||||
name = django_filters.CharFilter(lookup_expr='icontains')
|
||||
|
||||
class Meta:
|
||||
model = Keyword
|
||||
fields = ['name']
|
||||
|
||||
|
||||
class ShoppingListFilter(django_filters.FilterSet):
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
|
@ -1,3 +1,4 @@
|
||||
{% load crispy_forms_tags %}
|
||||
{% load i18n %}
|
||||
{% load django_tables2 %}
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{% extends "base.html" %}
|
||||
{% load crispy_forms_tags %}
|
||||
{% load i18n %}
|
||||
{% load django_tables2 %}
|
||||
|
||||
@ -9,26 +8,13 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="table-container">
|
||||
<h3 style="margin-bottom: 2vh">{% trans 'Manage Keywords' %}
|
||||
<h3 style="margin-bottom: 2vh">{% trans 'Manage Keywords' %} {% trans 'List' %}
|
||||
{% if create_url %}
|
||||
<a href="{% url create_url %}"> <i class="fas fa-plus-circle"></i>
|
||||
</a>
|
||||
{% endif %}
|
||||
</h3>
|
||||
|
||||
{% if filter %}
|
||||
<br/>
|
||||
<br/>
|
||||
<form action="." method="get">
|
||||
{% csrf_token %}
|
||||
{{ filter.form|crispy }}
|
||||
<button type="submit" class="btn btn-success">{% trans 'Filter' %}</button>
|
||||
<a href="{% url 'manage_keywords' %}"
|
||||
class="btn btn-secondary shadow-none">{% trans 'Clear' %}</a>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
|
||||
{% render_table table %}
|
||||
|
||||
</div>
|
||||
|
@ -1,4 +1,3 @@
|
||||
from cookbook.filters import KeywordFilter
|
||||
from cookbook.helper.permission_helper import group_required
|
||||
from cookbook.models import Keyword
|
||||
from cookbook.tables import ManageKeywordTable
|
||||
@ -10,17 +9,11 @@ from django.utils.translation import gettext as _
|
||||
|
||||
@group_required('user')
|
||||
def keywords(request):
|
||||
f = KeywordFilter(
|
||||
request.GET,
|
||||
queryset=Keyword.objects.all().order_by('pk')
|
||||
)
|
||||
|
||||
table = ManageKeywordTable(f.qs)
|
||||
table = ManageKeywordTable(Keyword.objects.all())
|
||||
RequestConfig(request, paginate={'per_page': 25}).configure(table)
|
||||
|
||||
return render(
|
||||
request,
|
||||
'manage/keywords.html',
|
||||
{'title': _("Keyword"), 'table': table,
|
||||
'create_url': 'new_keyword', 'filter': f}
|
||||
{'title': _("Keyword"), 'table': table, 'create_url': 'new_keyword'}
|
||||
)
|
||||
|
Reference in New Issue
Block a user