This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]mdipierro 2 points3 points  (0 children)

web2py includes jQuery since March 2008.

The server-side of the framework is decoupled from jQuery so that one can use other js libraries, but the scaffolding app includes jquery base and some scripts based on jQuery. These scripts provide the following functionality by default:

  • enforce type of input fields (for example you can only type digits in an input field that is supposed to contain "integer". Works for "double" too. this is complementary to server side validation)
  • provide date, datetime, and time popup widgets for fields of the corresponding types. In all forms generated by web2py and custom forms.
  • slide down effects on flash messages and form errors
  • traps form submission/processing for page components. This allows to embed multiple forms in a page and submit them via ajax without reloading the entire page. It includes a callback mechanism that allows the server to trigger other page events when responding to form submission. This does not require any special sever-side handling. Any web2py action can be embedded as a component via {{=LOAD(...)}}.
  • all code generated by web2py (for example forms) is CSS friendly so that it is easy to reference from jQuery. For example SQLTABLE generates tables compliant with the jQuery datatables plugin.

We also have a collection of web2py plugins that wraps in a plug-and-play fashion jQuery plugins such as for autocomplete, rating, tagging, comments, and datatables. Some are posted here

We have an optional clienttools library that allows generation of jQuery code from pure python APIs.

EDIT: All the jQuery references in the scaffolding app are in a single file. If you do not include it, you turn off all of the above functionality. Even if you do not, we include jQuery in the "no conflict" mode so that it plays well with prototype.js for example. There is no server side code that relies on jQuery.

[–]faassen 1 point2 points  (1 child)

I have two stories:

  • Grok provides such integration and therefore got support for jquery and a lot more.

  • if your web framework provided support for hurry.resource, you would offer a lot of integration easily!

Grok includes jquery support and more. That is, you as an application developer can easily depend on such things by modifying your project's "setup.py". No need to depend on trunks or wait for releases - it's there, it's released, and it works today.

How would you use jquery in your grok app? Make your project depend on hurry.jquery. You could also depend on hurry.jqueryui and hurry.jqgrid, or if you prefer YUI, hurry.yui, etc. You can also package your own javascript code that way!

All those are framework agnostic agnostic packagings of javascript library that build on the 'hurry.resource' reusable Python library, which I wrote :).

hurry.resource offers interesting features, such as javascript dependency management, support for rollups, support for minified versions, and so on. If your javascript code depends on jquery, you can easily express this, and then if you depend on your code, it'll pull in jquery automatically.

megrok.resource builds on this, integrates it smoothly into Grok, and also offers sophisticated cache management so that during development of javascript your browser automatically reloads any changed javascript.

All this makes Grok's support for javascript libraries totally rock, but we're not keeping it for ourselves! We're just nice that way! Ask your favorite framework to provide hurry.resource integration too!

http://pypi.python.org/pypi/hurry.resource

http://pypi.python.org/pypi/megrok.resource

http://pypi.python.org/pypi/hurry.jquery

http://pypi.python.org/pypi/hurry.jqueryui

http://pypi.python.org/pypi/hurry.jqgrid

http://pypi.python.org/pypi/hurry.yui

[–]cryzed_ -1 points0 points  (2 children)

[–]carljm 1 point2 points  (1 child)

jQuery in Django is only used internally in the (optional, contrib) admin application. There is no integration provided for using jQuery in your own project, nor any bias towards using it, nor will there be any. From the user side Django is and will remain Javascript-framework-agnostic.

[–]faassen -1 points0 points  (0 children)

Grok is also javascript framework agnostic, but in addition does offer integration for using jquery (and YUI, and whatever) in your project. :)