added notes on jQuery #639

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
5 participants
Contributor

evildmp commented Jan 11, 2013

I have tried to make the advice on what to do about jQuery in admin a bit clearer and the recommendations stronger.

Also, I couldn't find any mention of https://github.com/django/django/blob/master/django/contrib/admin/options.py#L401 in the docs.

Ticket: https://code.djangoproject.com/ticket/19597

docs/ref/contrib/admin/index.txt
+``jquery.js`` and ``jquery.min.js`` respectively.
+
+The ``BaseModelAdmin`` superclass has a ``media`` property that returns a list
+of media files' URLS to the form. If :setting:`DEBUG` is ``True`` it will return
@kezabelle

kezabelle Jan 11, 2013

Contributor

media files' URLS is doesn't read particularly nicely, though the other option, media file URLs isn't much better.

Member

mjtamlyn commented Jan 11, 2013

Hmmm, I think this section of the docs should also mention the age of the included jQuery. Admin still runs on jQuery 1.4 which is probably not what you might expect if you include it for your own purposes. We have a few cases where we have both jQuery for django and a more modern version included to use other plugins on admin pages.

Contributor

evildmp commented Jan 11, 2013

How about instead of "It's also generally recommended that you make use of jquery.js as provided by Django" then:

If possible, use jquery.js as provided by Django, rather than calling in your own version.

and noting that Django's jQuery is somewhat old?

Member

mjtamlyn commented Jan 11, 2013

Hmm, personally I wouldn't use the admin's jQuery for anything now so I would prefer the extra load.

Even better, update the jQuery. I don't know the reasons why/why not, but I don't think the django docs should be recommending the use of a version of a library which is 3 years out of date... You regularly run into issues with compatibility with modern plugins.

Contributor

evildmp commented Jan 11, 2013

Also, perhaps it is worth treating the two issues in this as separate - the uncompressed and 'minified' jQuery note is about a different matter.

Member

mjtamlyn commented Jan 11, 2013

True, not worth having both, but kinda irrelevant if you're not using it....

Contributor

evildmp commented Jan 11, 2013

I thought I'd commented on this but must have deleted it before hitting comment:

Even better, update the jQuery. I don't know the reasons why/why not, but I don't think the django docs should be recommending the use of a version of a library which is 3 years out of date... You regularly run into issues with compatibility with modern plugins.

If the Django jQuery is so old that users might expect to need a newer version for their custom admin, then the docs should explain that.

I don't understand it well enough to explain it, but I am willing to ask questions about it on IRC until I do...

Is something like http://pypi.python.org/pypi/django-jquery/1.8.1 worth mentioning?

Member

mjtamlyn commented Jan 11, 2013

I would say no, as I think that python packages shouldn't exist solely to install static assets. I believe our front end department currently advocate getting jQuery from a CDN anyway... There's no clearly defined "way of doing it"...

On 11 January 2013 12:11, Marc Tamlyn notifications@github.com wrote:

I would say no, as I think that python packages shouldn't exist solely to
install static assets. I believe our front end department currently
advocate getting jQuery from a CDN anyway... There's no clearly defined
"way of doing it"...

What about Intranet use of Django? A settings field should be supplied to
manually point to another jQuery installation. I don't know whether the
Django admin can still work properly without jQuery. If it does, then I
think it would be fair not to provide jQuery with Django, and ask in the
installation procedure for the user to download the latest supported
version of jQuery if the user wants extended admin features.

Just my two cents.

Contributor

evildmp commented Jan 11, 2013

The advantage of supplying (or by default using) a reasonably up-to-date version of jQuery for Django would be that developers would have something they could rely on the admin to provide.

It might not be suitable for everyone, but it would be suitable for many, and particularly it would help people who are starting out; it's one less thing to worry about: "if you want to use jQuery in your Django application, you can use this one, in this way. If your needs are more complex, then you can [...]"

It would also mean that authors of reusable applications won't feel the need to include their own version, unless they really have to. I'm using a bunch of reusable applications, and in some admin templates I have a veritable plethora of conflicting jQuery versions being loaded. They seem more conflict-prone than teenaged children.

Member

mjtamlyn commented Jan 11, 2013

They seem more conflict-prone than teenaged children.

Welcome to Javascript...

Owner

timgraham commented Jan 16, 2013

Thanks for this. I've made some edits and committed it.

@timgraham timgraham closed this Jan 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment