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
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
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
As it took me a save option name instead of its value. This field are solves this rare problem.
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.
Adds Boolean like Filter in Admin to OneToOneField reference. Allowing to filter in the Parent for instances without Referenced Field. To register the filter, import in `urls.py` for example: import filterspecs Example `models.py`: from django.db import models class Place(models.Model): name = model.CharField(maxlength=50) address = model.CharField(maxlength=80) class Restaurant(meta.Model): place = model.OneToOneField(Place) place.exists_filter = True serves_hot_dogs = model.BooleanField() serves_pizza = model.BooleanField() Example `admin.py`: from django.contrib import admin from models import * class PlaceAdmin(admin.ModelAdmin): list_filter = ('restaurant',) admin.site.register(Place, PlaceAdmin) With this example PlaceAdmin will have a filter: By Restaurant All Yes No Where `Yes` will list `Place` with `Restaurant` instances, and `No` will list `Place` without `Restaurant` instances.
When developing a site, I sometimes want to be able to visually reference the HTML before it's given a real context, and a view. This extra bit of code will allow you to add a directory within your templates dir, and pull any html files and subdirectories from it. I added the if statement to automatically use an index.html file if there's no file and extension at the end. You can substitute anything you like for the "html" in "(?P<base>html)". That's just passed as an argument to prepend to the template as a base directory for the templates.
Memcached Property Attributes ----------------------------- Setting the attribute will store the value in memcached; accessing the attribute will retrieve from memcached. Most useful as a way of simulating memcached "fields" on model instances. See the docstring for details.
Django admin orders models by their primary key by default, which can be undesirable on very large tables. This shows how to disable any ordering on a model. Note that this behavior is fixed in 1.4 trunk.
Rename apache (or any) processes to be easily identified from ps output.
Here's the python code to produce an admin related widget with the edit and delete link also. * [RelatedFieldWidgetWrapper](http://djangosnippets.org/snippets/2562) * [related-widget-wrapper.html](http://djangosnippets.org/snippets/2563) * [related-widget-wrapper.js](http://djangosnippets.org/snippets/2564) * [RelatedWidgetWrapperAdmin](http://djangosnippets.org/snippets/2565)
Here's the python code to produce an admin related widget with the edit and delete link also. * [RelatedFieldWidgetWrapper](http://djangosnippets.org/snippets/2562) * [related-widget-wrapper.html](http://djangosnippets.org/snippets/2563) * [related-widget-wrapper.js](http://djangosnippets.org/snippets/2564) * [RelatedWidgetWrapperAdmin](http://djangosnippets.org/snippets/2565)
Save method, useful for automate pdf files creation if you want to use the file in database.
3110 snippets posted so far.