calendar.js can't find variable gettext

58 views
Skip to first unread message

Todd Blanchard

unread,
Nov 24, 2009, 8:56:05 PM11/24/09
to Django users
I'm trying to use the date/time entry widgets from admin and I get this javascript error and the controls don't render.

Where is this supposed to come from?

In annoyance, I have copied the head section precisely from an admin page that work.  Still doesn't work in my page.

    <link rel="stylesheet" type="text/css" href="/media/css/base.css" />
    <link rel="stylesheet" type="text/css" href="/media/css/forms.css" />
    <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/media/css/ie.css" /><![endif]-->


    <script type="text/javascript" src="../../../jsi18n/"></script>
    <link href="/static/olwidget/css/olwidget.css" type="text/css" media="all" rel="stylesheet" />
    <script type="text/javascript" src="/media/js/core.js"></script>
    <script type="text/javascript" src="/media/js/admin/RelatedObjectLookups.js"></script>
    <script type="text/javascript" src="/media/js/getElementsBySelector.js"></script>
    <script type="text/javascript" src="/media/js/actions.js"></script>
    <script type="text/javascript" src="/media/js/calendar.js"></script>
    <script type="text/javascript" src="/media/js/admin/DateTimeShortcuts.js"></script>
    <script type="text/javascript" src="http://openlayers.org/api/2.8/OpenLayers.js"></script>
    <script type="text/javascript" src="/static/olwidget/js/olwidget.js"></script>
    <script type="text/javascript" src="http://openstreetmap.org/openlayers/OpenStreetMap.js"></script>

Tim Valenta

unread,
Nov 24, 2009, 9:34:06 PM11/24/09
to Django users
I'm a little unclear on part of that... does this not work only on
certain pages? If it doesn't work at all anywhere, I'm not sure where
you got the HTML for a working page.

Are you sure that all of those URLs resolve to the right JS files? If
you go to the page which messes up, and view the source, I'd go
through the links one at a time and try to find out which one of them
may not work. It sounds like one of those is messing up.

Can you verify whether or not all of those links *for sure* work,
right there in the browser?

Tim

Karen Tracey

unread,
Nov 24, 2009, 11:42:59 PM11/24/09
to django...@googlegroups.com
On Tue, Nov 24, 2009 at 8:56 PM, Todd Blanchard <tblan...@mac.com> wrote:
I'm trying to use the date/time entry widgets from admin and I get this javascript error and the controls don't render.

Where is this supposed to come from?

In annoyance, I have copied the head section precisely from an admin page that work.  Still doesn't work in my page.

    <link rel="stylesheet" type="text/css" href="/media/css/base.css" />
    <link rel="stylesheet" type="text/css" href="/media/css/forms.css" />
    <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/media/css/ie.css" /><![endif]-->


    <script type="text/javascript" src="../../../jsi18n/"></script>


This is the one gettext would be coming from and I'm guessing the relative path here is causing a problem.  (gettext is internationalization support, and jsi18n is javascript internationalization support, I'd guess)  jsi18n is an admin view:

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/contrib/admin/sites.py#L213
http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/contrib/admin/sites.py#L253

It is not being pulled in via a form media definition but rather looks to be hardcoded into the templates that depend on it, for example:

http://code.djangoproject.com/browser/django/tags/releases/1.1.1/django/contrib/admin/templates/admin/change_list.html#L9

It seems using the admin widgets that use the i18n javascript is a bit more involved than just importing them and using them.  Maybe there is some elegant way you're supposed to pull in this javascript, but I don't know it (I don't know much when it comes to javascript).

Karen

Todd Blanchard

unread,
Nov 25, 2009, 12:32:38 AM11/25/09
to django...@googlegroups.com
Yep, I solved this by ripping and copying some code out of admin/sites.py
and adding a url conf for it.

It works now, but this should be included by default through the widget media dependency system.  Not very slick.  I tried filing a bug and the submission was rejected as spam.

-Todd Blanchard

--

You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django...@googlegroups.com.
To unsubscribe from this group, send email to django-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

Tim Valenta

unread,
Nov 25, 2009, 11:01:26 AM11/25/09
to Django users


On Nov 24, 10:32 pm, Todd Blanchard <tblanch...@mac.com> wrote:
> Yep, I solved this by ripping and copying some code out of admin/sites.py
> and adding a url conf for it.
>
> It works now, but this should be included by default through the widget media dependency system.  Not very slick.  I tried filing a bug and the submission was rejected as spam.

I'd just sign up for the account. It's pretty simple. Filing bugs is
how this thing gets better-- I'd urge you not to just let it drop.

Glad that that worked out for you. I learned something about it,
myself. It had never struck me that it was a view :)

Tim

>
> -Todd Blanchard
>
> On Nov 24, 2009, at 8:42 PM, Karen Tracey wrote:
>
>
>
> > On Tue, Nov 24, 2009 at 8:56 PM, Todd Blanchard <tblanch...@mac.com> wrote:
> > I'm trying to use the date/time entry widgets from admin and I get this javascript error and the controls don't render.
>
> > Where is this supposed to come from?
>
> > In annoyance, I have copied the head section precisely from an admin page that work.  Still doesn't work in my page.
>
> >     <link rel="stylesheet" type="text/css" href="/media/css/base.css" />
> >     <link rel="stylesheet" type="text/css" href="/media/css/forms.css" />
> >     <!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="/media/css/ie.css" /><![endif]-->
>
> >     <script type="text/javascript" src="../../../jsi18n/"></script>
>
> > This is the one gettext would be coming from and I'm guessing the relative path here is causing a problem.  (gettext is internationalization support, and jsi18n is javascript internationalization support, I'd guess)  jsi18n is an admin view:
>
> >http://code.djangoproject.com/browser/django/tags/releases/1.1.1/djan...
> >http://code.djangoproject.com/browser/django/tags/releases/1.1.1/djan...
>
> > It is not being pulled in via a form media definition but rather looks to be hardcoded into the templates that depend on it, for example:
>
> >http://code.djangoproject.com/browser/django/tags/releases/1.1.1/djan...

Todd Blanchard

unread,
Nov 25, 2009, 12:52:37 PM11/25/09
to django...@googlegroups.com
Did that, filed it. Ticket #12264

-Todd Blanchard
Reply all
Reply to author
Forward
0 new messages