Hello,
I am using the django-datetime-widget from
https://pypi.python.org/pypi/django-datetime-widget.
I did everything in the example given but cannot get it to actually work.
For the field I have it on in my template the button to select the calendar
is there, however it does not show up when pressed. I also checked the
output in my html page and the javascript for the control is there but the
only oddity I noticed was that the id for my field was set to
date_of_birth_0 rather than date_of_birth like I set in my code.
The relevant parts of my code are below:
forms.py
from datetimewidget.widgets import DateTimeWidget
class Meta:
model = patient
exclude = ['patientid', 'alternatepid']
widgets = {'date_of_birth': DateTimeWidget(attrs={'id':
"date_of_birth"})}
from my html template:
{% extends "base.html" %}
{% load crispy_forms_tags %}
{% block content %}
<form method="post" class="uniForm">
{% csrf_token %}
{% crispy form %}
<div class="form-actions">
<button type="submit" class="btn btn-primary">Save</button>
<a href="/" class="btn">Cancel</a>
</div>
</form>
{% endblock %}
<script src="{{ STATIC_URL }}jquery-1.10.0.js"></script>
<link href="{{ STATIC_URL }}bootstrap/css/bootstrap.css" rel="stylesheet"
type="text/css"/>
<script src="{{ STATIC_URL }}bootstrap/js/bootstrap.js"></script>
{{ form.media }}
>From the actual html output:
<div id="div_id_date_of_birth" class="control-group"><label for="
date_of_birth_0" class="control-label requiredField"> Date of Birth<span
class="asteriskField">*</span></label><div class="controls"><div id="
5da23c7a76464ad1bfe166e2c464ac46" class="input-append date
form_datetime"><input
class="datetimeinput" id="date_of_birth_0" name="date_of_birth_0" type="text"
/> <span class="add-on"><i class="icon-th"></i></span></div><script type="
text/javascript">$.fn.datetimepicker.dates['en'] = { days: ['Sunday',
'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday',
'Sunday'], daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
'Sun'], daysMin: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su'], months:
['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December'], monthsShort: ['Jan',
'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov',
'Dec'], meridiem: ['am', 'pm'], suffix: ['st', 'nd', 'rd', 'th'], today:
'Today'};$("#5da23c7a76464ad1bfe166e2c464ac46").datetimepicker({format :
'dd/mm/yyyy hh:ii',startDate : '',endDate : '',weekStart : 0,daysOfWeekDisabled
: [],autoclose : false,startView : 2,minView : 0,maxView : 4,todayBtn :
false,todayHighlight : false,minuteStep : 5,pickerPosition :
'bottom-right',showMeridian
: false,language : 'en-us',});</script></div>
There does not appear to be any missing refs or anything else I can see.
Just not sure where to go to figure out what is at issue here.
Any suggestions?
Thanks,
Tom
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.