Login

Tag "quotes"

Snippet List

Remove quotes from bits in a custom tag

A simple function that will remove the quote marks from every string in a list - if and only if the quote marks are the first and last character of the string, regardless of whether they are single or double quotes. Useful when parsing the arguments of a custom tag.

  • quotes
  • parse
  • custom-tags
  • tokens
Read More

Filter for adding quote marks

A template filter for adding curly quotes around a string. The filter understands enough HTML to put the quotes inside an initial paragraph begin and ending paragraph end, if they exist. Put the code inside a file in a templatetags subdir in your app, add a {% load myfile %} statement and you're ready to go with {{somebodysays|addquotes}}. Of course, beware the script kiddies, be careful with escaping.

  • templatetag
  • quotes
Read More

Random Quotes

Display a random quote. Just add some quotes to the app (you may want to add the administration interface options) and then load the template tag: `{% load random_quote %}` and then call the tag to display a random quote from the app `{% random_quote %}` feel free to improve it/whatever.. :)

  • templatetag
  • random
  • quotes
Read More

3 snippets posted so far.