Hello,
This is a port of a php class used to generate XML taconite command documents, useful for (very) easy and powerful ajaxy stuff, if you don't know what that is just check it there in french : http://www.desfrenes.com/playground/taconite/ or there in english : http://www.malsup.com/jquery/taconite/.
Basically what it does is generate an XML document that is later processed by a javascript plugin which executes a serie of DOM modifications.
About the code, I'm a Django beginner as well as a Python beginner so kind advices are welcome.
Cheers.
Displays an input with an add button. Clicking the add button creates a simple form - input with a submit button. Clicking the submit button will send the output to the server and return a value which is displayed.
Ever wanted to add an atypical [field lookup](http://www.djangoproject.com/documentation/db-api/#field-lookups) to the Django Admin list_filter filters, like `__isnull` or `__in`? This jQuery snippet allows you to do just that.
Since you can access those additional filters by directly typing them into in the Admin URL, the tricky part is to add those to the regular list_filter display. A lot of this code is spent checking on querystring matches which is ugly and error-prone -- if you see any problems or room for improvement, drop me a comment!
A suggestion of where to place this code is in `templates/admin/yourapp/yourmodel/change_list.html`. Mine kinda looks like this:
{% extends "admin/change_list.html" %}
{% block content %}
<script src="/static/js/jquery-1.2.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
// the JavaScript posted in this snippet
</script>
{{ block.super }}
{% endblock %}
Sometimes it can be time consuming to go through a bunch of objects in Django's
Admin if you only need to update one field in each. An example of this is an
`order` field that allows you to manually set the order for a queryset.
**This snippet contains examples of how to set up the Admin list_display to
make Ajax calls to a custom view.**
The following code may not be worthy of being a snippet, it's all pretty
straightforward, but here it is for those who just want to copy-and-paste.
Inspired by [snippet 550](http://www.djangosnippets.org/snippets/550/), this allows you to expand or collapse apps in the main Admin screen. Requires jQuery. If jquery.cookie.js is available it will remember which apps you have expanded.
Recommended usage:
Place the JavaScript in a file called `admin-expand.js`.
Create `templates/admin/base_site.html` in your templates directory (which is also a good place to [brand your Admin](http://djangobook.com/en/1.0/chapter06/#cn70)).
Put the following code near the top, and you're done (adjusting file paths as needed).
{% extends "admin/base.html" %}
{% block extrahead %}
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<script type="text/javascript" src="admin-expand.js"></script>
{% endblock %}
Adds a shortcut to edit releated objects right/ForeignKey fields.
an edit symbol will be shown right next to the "add annother" link on all select boxes,
with opens the releated object currently selected in a popup window.
**depends on jquery**
Add this to the head of "templates/admin/base.html".
you may need to add
`<script type="text/javascript" src="/path/to/jquery.js"></script>`
before it
A merged version of the many jQuery autocomplete widgets.
See [1](http://php.scripts.psu.edu/rja171/widgets/autocomplete.php) and [2](http://www.dyve.net/jquery/?autocomplete) for more information.
newforms widget for autocompleting text fields using jquery autocomplete plugin: http://jquery.bassistance.de/autocomplete/
to be implemented:
- store the pk value into an hidden field
- handling ChoiceFields and many others
massimo dot scamarcia at gmail.com
This is the result of my first tests with jQuery and Django.
After entering a search term it gets search results using ajax and json. Then is uses the rather crude `result_table` function to generate a table of results.
Django is on the serverside for generating json