Login

Snippets by delfick

Snippet List

Coffeescript compilation

All I wanted was for one to one compilation of coffeescript to javascript. * Without special templatetags * Without specifying explicit bundles * Served dynamically in development * Compiled by collectstatic for producton This code is the minimum required for this. There are two things to take into account: * list method to find coffeescript files to compile for collectstatic * find method to find coffeescript equivalent for a js file for django.contrib.staticfiles.views.serve. The list method will use the list method on all finders that come before it in STATICFILES_FINDERS to find all the files that end with .coffee and will return the equivalent .js path with a storage class that knows how to compile the coffeescript. The find method will use the find method on all finders that come before it in STATICFILES_FINDERS to locate the coffeescript file that is actually being requested. It will then compile the coffeescript into a file in settings.CACHE_DIR before serving that file.

  • development
  • staticfiles
  • coffeescript
  • collectstatic
Read More

Button Admin

This is an improvement on other ButtonAdmin implementations. A few features : It allows you to specify whether button appears on change form or change list; whether the form is to be saved before the resulting function is called; whether the button should be displayed Look at the bottom of the snippet for usage. And make sure you admin urls are enabled using (r'^admin/', include(admin.site.urls)) instead of the old method

  • admin
  • button
Read More

delfick has posted 2 snippets.