Comments (9)
Sorry, yes you're right, you shouldn't have to include the css/js directly as long as you include {{ form.media }}
somewhere in your template.
I was probably having problems because I was using the widgets without a form and I just include
{% if form %}{{form.media}}{% endif %}
in my base template.
from django-datetime-widget.
It started working by itself, still can't figure out though what was the reason, would be great if someone can throw some light on it
from django-datetime-widget.
Was it a Python error or a Javascript error? Looks like JS I guess but your formatting is a little casual :)
from django-datetime-widget.
Agree with Michael, looks like a JS error, if you could tell us where there error was thrown we would be able to debug further.
I guess since you got it working it could be closed now.
from django-datetime-widget.
I am having exactly the same problem. I have just installted the app within my Django project and, when I try to load the page, I get the same error:
** website/settings.py
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'allauth',
'allauth.account',
'session_security',
'leaflet',
'periodically',
'rpc4django',
'rest_framework',
'django_extensions',
'south',
'datetimewidget',
# ... and some more that I do not list
)
** forms.py:
from django import forms as django_forms
from datetimewidget import widgets as datetime_widgets
from services.leop.models import launch as launch_models
class LaunchForm(django_forms.ModelForm):
class Meta:
model = launch_models.Launch
fields = ('identifier', 'date')
widgets = {
'date': datetime_widgets.DateTimeWidget(
usel10n=True, bootstrap_version=3
)
}
The error that I am getting is a Javascript error: when jQuery tries to create the component, it cannot find the function (take a look at the attached screenshot).
What am I doing wrong?
from django-datetime-widget.
If it's the jquery datetimepicker() function it can't find I suspect the following isn't being included on the page anywhere.
<link href="/site_media/static/css/datetimepicker.css" type="text/css" media="all" rel="stylesheet" />
<script type="text/javascript" src="/site_media/static/js/bootstrap-datetimepicker.js"></script>
Try adding them to the template and see if that fixes it.
from django-datetime-widget.
Yes, you are right. I made a mistake and I did not include those files.
from django-datetime-widget.
Step 3 of basic configuration does say it but it is easy to miss - I had the same problem earlier today :)
I think the reason it is in configuration and installation is that you should really only include it on pages where you are actually using the widget.
from django-datetime-widget.
Actually, if you read carefully the HTML code, at least in my opinion, it looks like that code is meant to include "bootstrap" dependencies and not "bootstrap-datetimepicker"... that was the problem that I had: I read the section and I thought that I only would have to include bootstrap js/css files... it was weird at first, but I decided to stick to the manual... please correct me if I am wrong.
from django-datetime-widget.
Related Issues (20)
- Change icons HOT 1
- using Now as startDate HOT 1
- Duplicate ID in rendered widgets
- Time Disabled
- Use display names configured in user settings instead of usernames (if provided)
- Date format conversion to python miss many formats
- startDate and endDate Options
- Improve documentation
- Not working in Django 2.1 HOT 4
- Readme > format doesn't show available month options
- Suggestion for Django 1.8+: DurationWidget
- startDate, endDate and daysOfWeekDisabled not working HOT 2
- Back to 1899 HOT 7
- todayBtn needs to be added to boolean list HOT 1
- Add option to not style input as readonly HOT 3
- Next month, Prev month buttons not showing HOT 1
- Blackout dates, hours
- Inconsistency with boolean values HOT 1
- Multiple widgets in a single form HOT 1
- Error on Django 1.10
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-datetime-widget.