From 1cdc5fb4d2b7fa5904e57be86222c5e5bd203589 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Mon, 4 Jan 2021 15:48:32 +0100 Subject: [PATCH] datepicker from admin added, but does not work... --- eva/settings.py | 2 ++ evapp/forms.py | 12 ++++++++++++ evapp/templates/evapp/employee_form.html | 5 +++++ evapp/views.py | 4 +++- 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 evapp/forms.py diff --git a/eva/settings.py b/eva/settings.py index 6f250e0..ec840e3 100644 --- a/eva/settings.py +++ b/eva/settings.py @@ -25,6 +25,8 @@ SECRET_KEY = 'g%+i6+gkwt3zz@+k-5x1dtstuw4)&qd$lxd^bt2oswy5e1#dul' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True +STATIC_ROOT = BASE_DIR / 'staticfiles' + ALLOWED_HOSTS = [] diff --git a/evapp/forms.py b/evapp/forms.py new file mode 100644 index 0000000..c09a6a9 --- /dev/null +++ b/evapp/forms.py @@ -0,0 +1,12 @@ +from django.db import models +from django.contrib.admin.widgets import AdminDateWidget +from django.forms import ModelForm + +from .models import Employee + +class EmployeeForm(ModelForm): + class Meta: + model = Employee + fields = '__all__' + widgets = {'firstdate_employment': AdminDateWidget(), + 'firstdate_presence': AdminDateWidget(),} diff --git a/evapp/templates/evapp/employee_form.html b/evapp/templates/evapp/employee_form.html index ea305c8..2d5aefd 100644 --- a/evapp/templates/evapp/employee_form.html +++ b/evapp/templates/evapp/employee_form.html @@ -1,5 +1,8 @@ + +{% load i18n %} {% load static %} + @@ -10,6 +13,7 @@ +{% block content %}