Giter Site home page Giter Site logo

Comments (9)

ollytheninja avatar ollytheninja commented on August 21, 2024 1

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.

sidd-shah avatar sidd-shah commented on August 21, 2024

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.

michaeljones avatar michaeljones commented on August 21, 2024

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.

ollytheninja avatar ollytheninja commented on August 21, 2024

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.

rtubio avatar rtubio commented on August 21, 2024

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).

screenshot from 2015-01-10 19 50 57

What am I doing wrong?

from django-datetime-widget.

ollytheninja avatar ollytheninja commented on August 21, 2024

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.

rtubio avatar rtubio commented on August 21, 2024

Yes, you are right. I made a mistake and I did not include those files.

from django-datetime-widget.

ollytheninja avatar ollytheninja commented on August 21, 2024

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.

rtubio avatar rtubio commented on August 21, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.