From a935a2899b7a93d152075ec959f2eead9f35f38a Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Thu, 1 Feb 2018 12:53:41 +0100 Subject: [PATCH] crispy forms :) --- .idea/workspace.xml | 60 +++++++++++++++++------------------ Recipies/settings.py | 3 ++ cookbook/filters.py | 2 +- cookbook/templates/index.html | 3 +- 4 files changed, 36 insertions(+), 32 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index ba368f14..47d5e08f 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,9 +2,9 @@ - + + - @@ -265,7 +265,7 @@ - + @@ -333,8 +333,8 @@ - - + + @@ -623,14 +623,6 @@ - - - - - - - - @@ -657,7 +649,7 @@ - + @@ -674,23 +666,31 @@ - + - - + + - - + + + + + + + + + + \ No newline at end of file diff --git a/Recipies/settings.py b/Recipies/settings.py index 8ca53560..18f58ce5 100644 --- a/Recipies/settings.py +++ b/Recipies/settings.py @@ -29,6 +29,8 @@ ALLOWED_HOSTS = [] LOGIN_REDIRECT_URL = "index" LOGOUT_REDIRECT_URL = "index" +CRISPY_TEMPLATE_PACK = 'bootstrap4' + # Application definition INSTALLED_APPS = [ @@ -40,6 +42,7 @@ INSTALLED_APPS = [ 'django.contrib.staticfiles', 'django_tables2', 'django_filters', + 'crispy_forms', 'cookbook.apps.CookbookConfig', ] diff --git a/cookbook/filters.py b/cookbook/filters.py index 598c0327..5bbb8fd2 100644 --- a/cookbook/filters.py +++ b/cookbook/filters.py @@ -4,7 +4,7 @@ from cookbook.models import Recipe class RecipeFilter(django_filters.FilterSet): - name = django_filters.CharFilter(lookup_expr='iexact') + name = django_filters.CharFilter(lookup_expr='contains') class Meta: model = Recipe diff --git a/cookbook/templates/index.html b/cookbook/templates/index.html index e18077a1..fbed1f5b 100644 --- a/cookbook/templates/index.html +++ b/cookbook/templates/index.html @@ -1,5 +1,6 @@ {% extends "base.html" %} {% load django_tables2 %} +{% load crispy_forms_tags %} {% load i18n %} {% block title %}{% trans "Cookbook" %}{% endblock %} @@ -12,7 +13,7 @@
- {{ filter.form.as_p }} + {% crispy filter.form %}