python - samuelcolvin's django-bootstrap3-datetimepicker not showing calendar when clicked on input field -
i trying use samuelcolvin's django-bootstrap3-datetimepicker in based on eonasdan's bootstrap-datetimepicker forked nkunihiko's django-bootstrap3-datetimepicker show calendar user can select date , time , submit it. issue having when try click on field or on right button calendar icon in in demo website, not show me nothing.
i had add widgets.py
repo project since giving me no module named bootstrap3_datetime.widgets error.
would appreciate help
this have in models.py
:
class production(timestampedmodel): #some other code..... scheduled_date = models.datetimefield(null=true, blank=true) fully_produced_date = models.datetimefield(null=true, blank=true)
forms_schedule.py
:
from producer.widgets import datetimepicker django import forms .models import production class scheduleform(forms.modelform): class meta: model = production fields = ['scheduled_date', 'fully_produced_date'] scheduled_date = forms.datetimefield(required=false, widget=datetimepicker(options={"format": "yyyy-mm-dd hh:mm", "pickseconds": false})) # def clean_scheduled_date(self): # scheduled_date = self.cleaned_data.get('scheduled_date') # return scheduled_date def clean_fully_produced_date(self): fully_produced_date = self.cleaned_data.get('fully_produced_date') return fully_produced_date
views.py
def episodeschedule(request): title = 'podcast' title_align_center = true subtitle = 'setup | add episode' subtitle_align_center = true form = scheduleform(request.post or none) context = { "title": title, "subtitle": subtitle, "form": form } if form.is_valid(): instance = form.save(commit=false) scheduled_date = form.cleaned_data.get("scheduled_date") fully_produced_date = form.cleaned_data.get("fully_produced_date") instance.scheduled_date = scheduled_date instance.fully_produced_date = fully_produced_date instance.user = request.user instance.save() return render(request, "forms_schedule.html", context) else: return render(request, "forms_schedule.html", context)
and forms_schedule.html
:
{% extends "base.html" %} {% load crispy_forms_tags %} {% block content %} <div class="progress"> <div class="progress-bar progress-bar-striped progress-bar-success active" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width: 100%"> <span class="sr-only">100% complete</span> </div> </div> <div class="panel panel-default box-shadow--16dp col-sm-6 col-sm-offset-3"> <div class="panel-body"> <div class='row'> <div class='col-sm-12'> {% if title %} <h1 class='{% if title_align_center %}text-align-center{% endif %}'>{{ title }}<!-- : {{ get.clientsetup.company_name }} --></h1> {% endif %} {% if subtitle %} <h3 class='{% if subtitle_align_center %}text-align-center{% endif %}'>{{ subtitle }}</h4> {% endif %} <h5>schedule</h5> <form method='post' action=''>{% csrf_token %} {{ form|crispy }} <hr/> <input class='btn btn-info box-shadow--6dp' type='submit' value='save' /> <p> <p> <a class="btn btn-primary box-shadow--6dp" href="{% url 'dashboard' %}" role="button"><i class="fa fa-upload" aria-hidden="true"></i>  schedule episode</a> </form> </div> </div> </div> </div> {% endblock %}
settings.py
in installed apps add 'bootstrap3_datetime'
template
add following lines html head tag
{% block header %} {% load static %}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap /3.0.0 css/bootstrap.css"> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-theme.css"> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.js"></script> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.js"></script>
{{ form.media }} {% endblock %}
Comments
Post a Comment