datepicker from admin added, but does not work...

This commit is contained in:
Benni Bärmann 2021-01-04 15:48:32 +01:00
parent 9a339ba0e2
commit 1cdc5fb4d2
4 changed files with 22 additions and 1 deletions

View File

@ -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 = []

12
evapp/forms.py Normal file
View File

@ -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(),}

View File

@ -1,5 +1,8 @@
{% load i18n %}
{% load static %}
<script type="text/javascript" src="/admin/jsi18n/"></script>
<script type="text/javascript" src="{% static 'admin/js/core.js' %}"></script>
<script type="text/javascript" src="{% static 'admin/js/vendor/jquery/jquery.js' %}"></script>
@ -10,6 +13,7 @@
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/base.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}" />
{% block content %}
<center>
<style>
ul > li {
@ -37,3 +41,4 @@
<button type="submit" value="submit">Abschicken</button>
</form>
</center>
{% endblock %}

View File

@ -2,8 +2,10 @@ from django.shortcuts import render
from django.views.generic.edit import CreateView
from .models import Employee
from .forms import EmployeeForm
# Create your views here.
class EvaFormView(CreateView):
model = Employee
fields = '__all__' # ['firstname']
# fields = '__all__' # ['firstname']
form_class = EmployeeForm