This Template Tag computes the font-size of two given arguments and returns a CSS-encoded string like "font-size: XXpx;", which can be used to format the font-size of link. (The minium font-size must be set with CSS.)
Requires two arguments:
1. occurrence of the current tag
2. sum of all occurrences
It works great for my tag-cloud.
[Source of the logarithmic formula](http://www.php.de/php-fortgeschrittene/44928-tag-cloud-algorithmus-fuer-schriftgroessye.html)
**Usage**
`<a href="http://www.anything.com" {% cloudify variable.occurrence overall. occurrence_sum %} title="anything">any tag</a>`
Improved version of my snippet #1346. Now works correctly with multiple usernames and hash tags.
Both twitter usernames and hashtags are converted into links to twitter profiles and twitter search.
Updated, forgot about underscores in usernames.
When working with the ContentType model there are generally two issues.
1. Models are listed in the table but not imported.
2. Unicode only returns model not application so being able to select a a app/model is sometimes difficult when to applications have a model with the same name.
This snippet gets a listing of imported models and creates a drop down for selection. I also included a function that uses the returned from to get and
save the correct ContentType within the primary model.
runserver with extra development tools:
1. interactive debugger that pops up automatically if an exception occurs, courtesy of [Werkzeug](http://werkzeug.pocoo.org/documentation/dev/debug.html#using-the-debugger)
2. logging of print statements directly into HTML (div float), courtesy of [Paste](http://pythonpaste.org/modules/debug.prints.html).
Credits: [piranha.org.ua](http://piranha.org.ua/)
Django Pagination Template Tag that allows unlimited customization to the current Django Pagination.
Automatically creates template variables that can be used to display the pagination in any format that you can desire such as
Previous 1 2 3 [ 4 ] 5 6 7 Next
First Previous 12 14 15 16 17 [ 18 ] 19 20 22 25 Next Last
Showing 25 of 80 Results
First Page 23 27 30 33 [ 36 ] 38 41 44 50 Next Last
This is a simple URI Querystring generator that can be used with Django for generating URI Querystring and preserving the current
Currently working to port into a template tag to allow
{% urlgen page|5 %} {% urlgen page 5 %} {% urlgen page,5 %}
OR
{% urlgen sort name display all %} etc..
Simple decorator to render an html template or return a json response. The view must return a dict object.
Usage example:
@render('page.html')
def a_view(request):
#do something
return {'key': 'value'}
You have to put this code in your *searchengines* Firefox folder in a file called **djangosnippets.xml**
After restarting Firefox, you will be able to seek DjangoSnippets very easily.
I also create a favicon.ico since djangosnippets.org didn't have one ...
Path example : /usr/lib/iceweasel/searchplugins/djangosnippets.xml
Active class for navigation link
{% navclass default current url %}
First argument is the default class and second is the current class
Third argument is the url name(s) of the page
example: <a class="{% navclass leftnav curentnav name1,name2 %}" href="/about/">
This decorator is to make it's decorated function to commit the transaction on success (rollback otherwise) unless the transactions are being already managed.