djangosnippets.org: Latest snippets tagged with 'jquery'https://djangosnippets.org/tags/jquery/2021-01-11T14:31:59.592702-06:00Django Collapsed Stacked Inlines
2021-01-11T14:31:59.592702-06:00mkarajohnhttps://djangosnippets.org/snippets/10817/<p>A simple jQuery javascript that collapses all stacked inline rows for better handling of large inline fieldsets.</p>
<p>It also adds "Show"/"Hide"-buttons for showing/hiding each row, which could be customized and styled using css.</p>
<p><strong>Usage (see below for example):</strong></p>
<p>Include the javascript on your admin page, together with jQuery, and it'll …</p>
Freely redistributableDynamically adding forms to a formset. OOP version.
2015-05-13T17:46:29.378832-05:00halfnibblehttps://djangosnippets.org/snippets/10484/<p><strong>What It Is</strong></p>
<p>This is a JavaScript-based solution to dynamically add and remove forms in formsets and inlineformsets. It requires jQuery.</p>
<p>Originally based on this Snippet: https://djangosnippets.org/snippets/1389/</p>
<p>I have done a lot of work to make it OO, and am using it in production on pages with multiple inlineformsets, and …</p>
Freely redistributableAutocomplete TextInput Widget w/ Static Data (jQuery UI)
2013-03-15T14:26:29.005881-05:00JoeLinuxhttps://djangosnippets.org/snippets/2901/<p>Custom form widget for rendering an autocomplete (using jQuery UI's autocomplete widget) text input in a template.</p>
<p>This arose from the need to have all fields asking for a state to use autocomplete, so I decided to make this.</p>
Freely redistributableCitySelector
2012-02-23T06:24:08.007374-06:00JustDelighthttps://djangosnippets.org/snippets/2692/<p>CitySelector is a jquery widget, allowing to pick cities from DB, filled by django_ipgeobase application.
Also it includes widget for django forms, based on mentioned jquery plugin, views and urlconf, required to provide
interaction between widget and DB and middleware, populating request with correspondent location.</p>
<p>Visit https://bitbucket.org/JustDelight/city_selector</p>
Freely redistributableFilter change list by a date range
2012-02-05T23:50:34.056189-06:00arusenihttps://djangosnippets.org/snippets/2675/<p>The Django admin site has a feature to filter objects in change list by parameters supplied in the query string. Particularly, parameters such as date__gte and date__lte can be used.</p>
<p>This example is for filtering objects in change list by a date range (the date field is called expiration_date, but …</p>
Freely redistributableJquery ajax csrf framework for Django
2012-01-23T00:30:21.791394-06:00chriszweberhttps://djangosnippets.org/snippets/2656/<ol>
<li>
<p>Framework to extend the jquery ajax() function to construct post requests that contain a csrf token.</p>
</li>
<li>
<p>The example view used with the framework takes JSON data and returns JSON data containing either:</p>
</li>
<li>"success" with a message and additional dictionary of JSON data to use in the page</li>
<li>
<p>"error" with an …</p></li></ol>
Freely redistributableSimple ping ICMP with jquery
2011-09-30T12:26:58.431890-05:00magik_cypresshttps://djangosnippets.org/snippets/2559/<p>Ping ICMP ip with jquery.</p>
Freely redistributablemodels ColorField with clean minimal widget
2011-05-19T05:44:32.237425-05:00andybakhttps://djangosnippets.org/snippets/2441/<p>A simple model ColorField that allows picking from a predefined list (currently picked up from settings.py</p>
<p>The widget displays as a row of coloured SPAN's with the hex code inside. Simply click to choose a color.</p>
<p>(requires jQuery in the page assigned to it's normal $ shortcut. Easy to change …</p>
Freely redistributableJcrop Form
2011-01-10T02:51:31.067902-06:00mjthiehttps://djangosnippets.org/snippets/2316/<p>Implements a Django form that integrates image uploading plus cropping using the awesome Jcrop plugin (http://deepliquid.com/content/Jcrop.html).</p>
<p>NOTE: Still lacks proper error handling...</p>
Freely redistributableDrag and drop ordering of admin list elements for Grappelli
2011-01-03T08:50:27.583354-06:00sjaenschhttps://djangosnippets.org/snippets/2306/<p>Adds drag-and-drop ordering of rows in the admin list view for <a href="http://code.google.com/p/django-grappelli/">Grappelli</a>. This is based on <a href="http://djangosnippets.org/snippets/2057/">Snippet #2057</a> and fixes some bugs as well as switching to jQuery/jQuery UI provided by Grappelli. No additional files need to be installed.</p>
<p>The model needs to have a field holding the position …</p>
Freely redistributableImprove ajax progress bar by jquery extensions
2010-12-11T02:26:53.871758-06:00williamcaihttps://djangosnippets.org/snippets/2286/<p>This snippet in the one to improve the method described in <a href="http://djangosnippets.org/snippets/679/">http://djangosnippets.org/snippets/679/</a>. It uses some jquery extensions to make the task more easier: <strong>jquery.timers.js</strong>, <strong>jquery.progressbar.js</strong>, <strong>jquery.form.js</strong>.</p>
Freely redistributableAdmin Word Count
2010-10-06T01:02:23.544260-05:00bahoohttps://djangosnippets.org/snippets/2221/<p>I'm on my own personal writing challenge (see 750words.com for inspiration). I needed a way to get a dynamic word count, so I threw this together. Tied into django-basic-blog easily.
</p>
Freely redistributablesave form in ajax with jquery in django
2010-08-24T03:03:34.811936-05:00ralphleygahttps://djangosnippets.org/snippets/2172/<p>Code how to save ajax.in a form</p>
Freely redistributableDrag and drop admin list items
2010-08-23T06:17:42.862148-05:00chrsgrrtthttps://djangosnippets.org/snippets/2160/<p>Using jQuery UI (with Grappelli in use) to add "drag and drop" reordering of items in the admin list view. The model must have an "order" field to store the order value in.
</p>
Freely redistributableUse JQuery Calendar in ModelForm
2010-07-01T12:39:33.350435-05:00Induanehttps://djangosnippets.org/snippets/2088/<p>The important code really is just setting up the base site to use jquery and then using the javascript function to show the calendar on a widget with the .vDateField class set. The DateField modeltype automatically gets the css class .vDateField when using ModelForms.</p>
Freely redistributable