added datepicker from admin

This commit is contained in:
Benni Bärmann 2020-09-29 12:16:10 +02:00
parent 50b7f216fe
commit 616606fa81
2 changed files with 18 additions and 1 deletions

View File

@ -1,8 +1,13 @@
from django.db import models from django.db import models
from django.forms import ModelForm from django.forms import ModelForm, DateField
from django.contrib.admin.widgets import AdminDateWidget
from .models import Project from .models import Project
class ProjectForm(ModelForm): class ProjectForm(ModelForm):
start = DateField(widget=AdminDateWidget)
class Meta: class Meta:
model = Project model = Project
fields = '__all__' fields = '__all__'

View File

@ -1,3 +1,15 @@
{% 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>
<script type="text/javascript" src="{% static 'admin/js/jquery.init.js' %}"></script>
{{ form.media }}
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/base.css' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'admin/css/widgets.css' %}" />
<form action="" method="post"> <form action="" method="post">
{% csrf_token %} {% csrf_token %}
{{ form }} {{ form }}