Delete python compiled files (*.pyc)
This simply deletes all compiled python files in a folder.
- files
- delete
- delpyc
This simply deletes all compiled python files in a folder.
Just add it in templatetags/delicious.py In your template: <h3>Del.icio.us</h3> <ul class="list"> {% load delicious %} {% load_delicious_links %} {% for link in delicious_links %} <li><a href="{{link.link}}">{{link.title|safe}}</a></li> {% endfor %} </ul>
*Usage:* `list|sublist:"a:b"` Returns `list[a:b]` Accepts `":b"` and `"a:"` shortcuts Note that the double quotes are necessary
This is based on the Admin app functionality for dispatching calls. Once you put these two files in place then add the following to urls.py: from myProject import ajax urlpatterns = patterns('', ... # Add this to the urlpatterns list (r'^ajax/(.*)', ajax.dispatcher.urls), ...) you register a function or method with a name like so: from django.contrib import ajax def myAutoCompleteCall(request): ... ajax.dispatcher.register('myAutoComplete', myAutoCompleteCall) Then you can use the url: `http://www.mysite.com/ajax/myAutoComplete` Previously I had placed this app in the django\\contrib directory because I wanted to use it in an Admin app mod. Since the release of 1.1 I was able to move it out into a standard app because of the new `formfield_overrides` property of the `ModelAdmin` class.
usage: 1、 {% exec %} class A: def __call__(self): print "I Love Python!"; {% endexec %} 2、 {% exec from django.conf import settings; %} 3、 {% exec %} try: html = '' if book: html = book.TransToHtml().encode('utf8'); except Exception,msg: html = str(msg); if settings.TEMPLATE_DEBUG: open('c:/index.html','wb').write(html); {% endexec %}
3110 snippets posted so far.