From d2c7990ee98cc5d22ea432475c5cb29cfd05e380 Mon Sep 17 00:00:00 2001 From: ferdzo Date: Tue, 18 Apr 2023 14:29:16 +0200 Subject: [PATCH] Changed HTMX templates --- serviceCRM/forms.py | 8 ++++-- serviceCRM/settings.py | 5 +++- serviceCRM/templates/serviceCRM/base.html | 21 +++++++++++++++ serviceCRM/templates/serviceCRM/form.html | 32 ++++------------------- 4 files changed, 36 insertions(+), 30 deletions(-) create mode 100644 serviceCRM/templates/serviceCRM/base.html diff --git a/serviceCRM/forms.py b/serviceCRM/forms.py index fd299b6..7bd8b40 100644 --- a/serviceCRM/forms.py +++ b/serviceCRM/forms.py @@ -1,13 +1,17 @@ from django import forms from .models import Insert +class DateInput(forms.DateInput): + input_type = 'date' class InputForm(forms.ModelForm): class Meta: model = Insert fields = {"name", "phone", "description", "date","done"} - labels = {'name': "Name", 'phone': "Phone", 'date': "Date", 'description': "Description",'done':"Done"} - + labels = {'name': "Name", 'phone': "Phone", 'date': "Date", 'description': "Description",'done':"Done"} + widgets = { + 'date': DateInput(), + } field_order =["name", "phone", "description", "date","done"] # name = forms.CharField(label="Name", max_length=30) diff --git a/serviceCRM/settings.py b/serviceCRM/settings.py index 627bb12..5f38c6e 100644 --- a/serviceCRM/settings.py +++ b/serviceCRM/settings.py @@ -40,8 +40,11 @@ INSTALLED_APPS = [ 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', - 'crispy_forms' + 'crispy_forms', + 'crispy_bootstrap5' ] +CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5" +CRISPY_TEMPLATE_PACK = "bootstrap5" MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', diff --git a/serviceCRM/templates/serviceCRM/base.html b/serviceCRM/templates/serviceCRM/base.html new file mode 100644 index 0000000..e8931e3 --- /dev/null +++ b/serviceCRM/templates/serviceCRM/base.html @@ -0,0 +1,21 @@ + + + + + + + Service + + +
+
+
+

Django People

+
+ {% block content %} + {% endblock %} +
+
+
+ + \ No newline at end of file diff --git a/serviceCRM/templates/serviceCRM/form.html b/serviceCRM/templates/serviceCRM/form.html index 7244172..9bfab79 100644 --- a/serviceCRM/templates/serviceCRM/form.html +++ b/serviceCRM/templates/serviceCRM/form.html @@ -1,31 +1,9 @@ - - - - - - - Document - - - - - +{% extends 'base.html' %} +{% block content %} +{% csrf_token %}
- {% comment %}
-
-
-
-
-
-
-
-
- {% endcomment %} - {% csrf_token %} {{form.as_p}} - - +
- - \ No newline at end of file +{% endblock%} \ No newline at end of file