Looked at this link and found some help but I am wondering how I can choose to use a JQueryUI Datepicker widget for a DateField I have in my models.py
models.py
from django.db import models
class EModel(models.Model):
date = models.DateField(blank=False)
forms.py
from django import forms
from models import EModel
class EForm(forms.ModelForm):
class Meta:
model = EModel
form.html - How Django renders my form. Not in the admin page
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Form</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
</head>
<body>
<form action="" method="post">{% csrf_token %}
{{ form.date }} <!-- ***** -->
<!-- The rest of my form -->
</form>
</body>
I am hoping for a way to make my 'date' model field render as a JQueryUI Datepicker widget, but I have searched around and found no way to link the two (in my case).
SOLUTION
In my forms.py
from django import forms
from models import EModel
class EForm(forms.ModelForm):
class Meta:
model = EModel
widgets = {
'date' : forms.DateInput(attrs={'type':'date'})
}