Login

Snippets by punteney

Snippet List

Auto HTML Linebreak filter

This custom filter is helpful if you want to convert plain text to include html line breaks but you aren't sure if the text is actually plain text or if it already contains html line breaks. First the filter looks for if the text contains any br, p, or table tags, if it does the text is returned as is. If it doesn't then the same functionality as the [linebreaks](http://www.djangoproject.com/documentation/templates/#linebreaks) filter is applied to the text.

  • filter
  • html
  • linebreaks
  • custom-filter
Read More

In page edit object links

This javascript has the functionality of the 'Edit Object' bookmarklet as [described by James Bennett](http://www.b-list.org/weblog/2007/nov/07/bookmarklets/) but instead of putting it within a bookmarklet it creates a div on the page with a link to the main admin screen, an edit the object link, and logout link. Just include the javascript on any page you want the links to show up on and make sure that the page is using the populate_xheaders function to provide the needed headers as [described here](http://www.b-list.org/weblog/2007/nov/07/bookmarklets/). The built in generic views provide the needed headers by default.

  • admin
  • edit-object-links
Read More

punteney has posted 2 snippets.