Browse Source

added datepicker from admin

master
Benni Baermann 4 years ago
parent
commit
616606fa81
2 changed files with 18 additions and 1 deletions
  1. +6
    -1
      input/forms.py
  2. +12
    -0
      input/templates/input/project.html

+ 6
- 1
input/forms.py View File

@ -1,8 +1,13 @@
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
class ProjectForm(ModelForm):
start = DateField(widget=AdminDateWidget)
class Meta:
model = Project
fields = '__all__'

+ 12
- 0
input/templates/input/project.html 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">
{% csrf_token %}
{{ form }}

Loading…
Cancel
Save