Announcing FeinCMS Extensions
Django time widget with custom time shortcuts
This small javascript snippet replaces standard django clock shortcuts Midnight, Noon, Now & 6am with various time increments .

$(window).load(function() {
$('.timelist').each(function(num, el) {
time_format = get_format('TIME_INPUT_FORMATS')[0];
$(el).html('');
for (i=8; i<20; i++) {
var time = new Date(1970,1,1,i,0,0);
lnk = "javascript:DateTimeShortcuts.handleClockQuicklink(" + num +
", '" + time.strftime(time_format) + "');"
$(el).append('<li><a href="'lnk'">' + time.strftime('%H:%M') + '</a></li>');
}
});
});
This snippet use JQuery which is available with Django 1.2. (dev at time of writing)
Also, javascript should be loaded after DateTimeShortcuts.js but unfortunately I didn’t find a better way to achive this but to add in modified base admin site templates/admin/base_site.html. If you have any suggestion for improvement, let me know in comments.
Django-simpleadmindoc
I started this project as I needed to deliver help and documentation for django-admin on client website and admindocs seems more oriented to developers than to users.
http://github.com/bmihelac/django-simpleadmindoc

Django set language for admin
If you want to explicitly set language for django admin section use this middleware:
from django.conf import settings
class AdminLocaleURLMiddleware:
def process_request(self, request):
if request.path.startswith('/admin'):
request.LANG = getattr(settings, 'ADMIN_LANGUAGE_CODE', settings.LANGUAGE_CODE)
translation.activate(request.LANG)
request.LANGUAGE_CODE = request.LANG
Then put somewhere in settings.py:
ADMIN_LANGUAGE_CODE=’it’
and add middleware:
MIDDLEWARE_CLASSES = (
...
'utils.multilang.middleware.AdminLocaleURLMiddleware',
....
Can't connect to MySQL when touching django.wsgi
Error when touching django.wsgi: Can’t connect to MySQL server…
did not help unless restarted apache.
Solution that did work is to set DATABASE_PORT to ‘3306’ instead of empty string. Not sure why…
I am Bojan Mihelac and this blog is dedicated to share code, thoughts, tools and advices I came up with while working at