Note that there are some explanatory texts on larger screens.

plurals
  1. POBootstrap-datepicker with django 1.4
    primarykey
    data
    text
    <p>I know there is a very similar issue <a href="https://stackoverflow.com/questions/11752223/twitter-bootstrap-date-picker-not-working">datepicker</a>, but I have not been able to solve it myself, since I consider my problem it's different. So I am trying to use bootstrap-datepicker <a href="http://www.eyecon.ro/bootstrap-datepicker/" rel="nofollow noreferrer">bootstrap-datepicker</a> in my local django project. I have a little experience using django, currently using version 1.4. I have a ModelForm which i want to be able to use a datepicker interface for some DateField. I render the form field correctly in the template using: </p> <pre><code> &lt;div class="well"&gt; &lt;input type="text" class="span2" value="02/16/12" data-date-format="mm/dd/yy" id="datepicker" &gt; &lt;/div&gt; </code></pre> <p>And at the bottom of my template I have the following JS code:</p> <pre><code>&lt;script&gt; $("#datepicker").datepicker(); &lt;/script&gt; </code></pre> <p>Now, in my base layout template I have the following:</p> <pre><code>&lt;link rel="stylesheet" href="{{ STATIC_URL }}css/bootstrap.css"/&gt; &lt;link rel="stylesheet" href="{{ STATIC_URL }}css/datepicker.css"/&gt; {% block head %}{% endblock %} {% include "layouts/header.html" %} {% block content %}{% endblock %} {% include "layouts/footer.html" %} &lt;script src="{{ STATIC_URL }}js/bootstrap.js"&gt;&lt;/script&gt; &lt;script src="{{ STATIC_URL }}js/bootstrap-datepicker.js"&gt;&lt;/script&gt; {% block scripts %}{% endblock %} </code></pre> <p>The template where I want to render the datepicker of course includes the base layout template: </p> <pre><code>{% extends "layouts/base.html" %} </code></pre> <p>My static files are distributed the following way:</p> <pre><code>Project/ apps/ static/ css/ bootstrap.css datepicker.css datepicker.less js/ bootstrap.js bootstrap-datepicker.js </code></pre> <p>I have never used JS before in my project so it might have something to do, but still, when I render my form the DateField shows ok as the datepicker example its just I can't make it deploy the widget where you get to choose the date from the calendar. Everytime I reload the url with the form I get the following in runserver:</p> <pre><code>[22/Oct/2012] "GET /element/new HTTP/1.1" 200 9547 [22/Oct/2012] "GET /static/js/bootstrap.js HTTP/1.1" 304 0 [22/Oct/2012] "GET /static/css/datepicker.css HTTP/1.1" 304 0 [22/Oct/2012] "GET /static/js/bootstrap-datepicker.js HTTP/1.1" 304 0 [22/Oct/2012] "GET /static/css/bootstrap.css HTTP/1.1" 200 118150 </code></pre> <p>I would appreciate a lot any kind of help. If you need my settings.py is in the following link: <a href="http://pastie.org/5099431" rel="nofollow noreferrer">settings.py</a></p> <p>Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload