Template tag to convert number of seconds into mm:ss format
Template tag to convert number of seconds into mm:ss format
- templatetag
- format
- time
Template tag to convert number of seconds into mm:ss format
Have you ever wanted a decorator that you could apply either straight-out: @mydec def myfun(...): ... or with special arguments: @mydec(special=foo) def myfun(...): ... ? Well, decorate it with this metadecorator, and voila. (I had this idea independently, but it's been done before as decorator_withargs: http://osdir.com/ml/python.ideas/2008-01/msg00048.html. My version is actually useful because it deals with signatures and calling directly.) As http://www.siafoo.net/article/68 points out, the standard decorator module has too much magic: the "@decorator" decorator expects a wrapping function, not a working decorator. This module fixes that.
These are the whole scripts that worked for me as a django (1.3) persian datetime widget.
Detect Spam or Ham with a konkr web-service https://konkr.com/api-documentation
Detect Spam or Ham with a konkr web-service https://konkr.com/api-documentation
Helpful for maintaining state of a BooleanField in the querystring, eg. checkbox=0 / checkbox=1
Add login_required (or any other combination of decorators) to any view references by the urls created by patterns(...). My personal little itch as an example... urlpatterns += required( login_required, patterns('', (r'^api/', include(api.urls)), ) )
If you are interested to use Ext JS 4 with Django take a look of the project that I created: https://github.com/TofPlay/django-easyextjs4
I used the code from http://djangosnippets.org/snippets/901/ and expanded the code to have the possibility to map AD groups to the superuser attribute of Django's users. The code updates the Django users database every time a user connects, so every change in the AD is replicated to the Django database.
As it took me a save option name instead of its value. This field are solves this rare problem.
if you have multiple choice field in front and you need just a string contains chosen values this is it! Unicode encoding row related with another snippet - "Switched value typed choice field", In typical cases, you do not need to call additional methods.
Decrease the verbosity of writing view tests. Also available here: https://gist.github.com/1310549.
Sometimes I don't want to reveal a staff-only view so I created this decorator, using ``django.contrib.admin.views.decorators.staff_member_required`` as my boilerplate. Non staff members are kicked to the 404 curb. Suggestion: Create a file, ``decorators.py`` in your project (or single app) and import like so: ``from myproject.app_name.decorators import staff_or_404``.
Just a quick and dirty solution I needed to uniquely color code entries in a selection form list. It uses the hashlib to generate it's coloring.
Support authentication https://github.com/jpulgarin/django-tokenapi for django-piston